Fix user creation to use UUIDs correctly
Also updates the notification send method to be cleaner and more maintainable
This commit is contained in:
parent
410a0cca9a
commit
4457634127
5 changed files with 97 additions and 171 deletions
|
@ -1,14 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Notifications;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
@ -19,7 +13,15 @@ class AccountCreated extends Notification implements ShouldQueue
|
|||
use Queueable;
|
||||
|
||||
/**
|
||||
* The password reset token to send.
|
||||
* The authentication token to be used for the user to set their
|
||||
* password for the first time.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* The user model for the created user.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
|
@ -28,11 +30,13 @@ class AccountCreated extends Notification implements ShouldQueue
|
|||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param aray $user
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param string|null $token
|
||||
*/
|
||||
public function __construct(array $user)
|
||||
public function __construct(User $user, string $token = null)
|
||||
{
|
||||
$this->user = (object) $user;
|
||||
$this->token = $token;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,12 +60,12 @@ class AccountCreated extends Notification implements ShouldQueue
|
|||
{
|
||||
$message = (new MailMessage)
|
||||
->greeting('Hello ' . $this->user->name . '!')
|
||||
->line('You are recieving this email because an account has been created for you on Pterodactyl Panel.')
|
||||
->line('You are recieving this email because an account has been created for you on ' . config('app.name') . '.')
|
||||
->line('Username: ' . $this->user->username)
|
||||
->line('Email: ' . $notifiable->email);
|
||||
->line('Email: ' . $this->user->email);
|
||||
|
||||
if (! is_null($this->user->token)) {
|
||||
return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->user->token . '?email=' . $notifiable->email));
|
||||
if (! is_null($this->token)) {
|
||||
return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . $this->user->email));
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue