Skip to content

Commit 397172d

Browse files
committed
Better notification for user creation, only add button if needed.
1 parent 008cccb commit 397172d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/Notifications/AccountCreated.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,16 @@ public function via($notifiable)
6969
*/
7070
public function toMail($notifiable)
7171
{
72-
return (new MailMessage)
72+
$message = (new MailMessage)
7373
->greeting('Hello ' . $this->user->name . '!')
7474
->line('You are recieving this email because an account has been created for you on Pterodactyl Panel.')
7575
->line('Username: ' . $this->user->username)
76-
->line('Email: ' . $notifiable->email)
77-
->action('Setup Your Account', url('/auth/password/reset/' . $this->user->token . '?email=' . $notifiable->email));
76+
->line('Email: ' . $notifiable->email);
77+
78+
if (! is_null($this->user->token)) {
79+
return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->user->token . '?email=' . $notifiable->email));
80+
}
81+
82+
return $message;
7883
}
7984
}

0 commit comments

Comments
 (0)