From 6a996c7c0cf9ab1836d85d19a78fae734f432b71 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 17 Feb 2017 19:35:26 -0500 Subject: [PATCH] Fix account creation email --- app/Notifications/AccountCreated.php | 2 +- app/Observers/UserObserver.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 8e66a7485..b7f86361c 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -38,7 +38,7 @@ class AccountCreated extends Notification implements ShouldQueue * * @var string */ - public $token; + public $user; /** * Create a new notification instance. diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index 437a82a69..258174ffb 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -24,6 +24,7 @@ namespace Pterodactyl\Observers; +use DB; use Pterodactyl\Events; use Pterodactyl\Models\User; use Pterodactyl\Notifications\AccountCreated; @@ -51,10 +52,11 @@ class UserObserver { event(new Events\User\Created($user)); + $token = DB::table('password_resets')->where('email', $user->email)->orderBy('created_at', 'desc')->first(); $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(), + 'token' => (! is_null($token)) ? $token->token : null, ]))); }