Better user creation email.

This commit is contained in:
Dane Everitt 2017-02-17 18:48:57 -05:00
parent 3240601d03
commit 95171a3e41
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
5 changed files with 14 additions and 20 deletions

View File

@ -12,6 +12,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Changed ### Changed
* `[pre.2]` — File Manager now displays relevant information on all screen sizes, and includes better button clicking mechanics for dropdown menu. * `[pre.2]` — File Manager now displays relevant information on all screen sizes, and includes better button clicking mechanics for dropdown menu.
* Reduced the number of database queries being executed when viewing a specific server. This is done by caching the query for up to 60 minutes in memcached. * Reduced the number of database queries being executed when viewing a specific server. This is done by caching the query for up to 60 minutes in memcached.
* User creation emails include more information and are sent by the event listener rather than the repository.
## v0.6.0-pre.2 (Courageous Carniadactylus) ## v0.6.0-pre.2 (Courageous Carniadactylus)
### Fixed ### Fixed

View File

@ -45,9 +45,9 @@ class AccountCreated extends Notification implements ShouldQueue
* *
* @return void * @return void
*/ */
public function __construct($token) public function __construct(array $user)
{ {
$this->token = $token; $this->user = $user;
} }
/** /**
@ -70,8 +70,10 @@ class AccountCreated extends Notification implements ShouldQueue
public function toMail($notifiable) public function toMail($notifiable)
{ {
return (new MailMessage) return (new MailMessage)
->line('You are recieving this email because an account has been created for you on Pterodactyl Panel.') ->greeting('Hello ' . $this->user->name . '!')
->line('Email: ' . $notifiable->email) ->line('You are recieving this email because an account has been created for you on Pterodactyl Panel.')
->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . $notifiable->email)); ->line('Username: ' . $this->user->username)
->line('Email: ' . $notifiable->email)
->action('Setup Your Account', url('/auth/password/reset/' . $this->user->token . '?email=' . $notifiable->email));
} }
} }

View File

@ -75,17 +75,4 @@ class SendPasswordReset extends Notification implements ShouldQueue
->action('Reset Password', url('auth/password/reset', $this->token)) ->action('Reset Password', url('auth/password/reset', $this->token))
->line('If you did not request a password reset, no further action is required.'); ->line('If you did not request a password reset, no further action is required.');
} }
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
} }

View File

@ -49,6 +49,12 @@ class UserObserver
public function created(User $user) public function created(User $user)
{ {
event(new Events\User\Created($user)); event(new Events\User\Created($user));
$user->notify((new AccountCreated([
'name' => $user->name_first,
'username' => $user->username,
'token' => DB::table('password_resets')->where('email', $user->email)->orderBy('created_at', 'desc')->first(),
])));
} }
/** /**

View File

@ -105,8 +105,6 @@ class UserRepository
'token' => $token, 'token' => $token,
'created_at' => Carbon::now()->toDateTimeString(), 'created_at' => Carbon::now()->toDateTimeString(),
]); ]);
$user->notify((new AccountCreated($token)));
} }
DB::commit(); DB::commit();