Password Reset work

This commit is contained in:
Deon George
2020-01-22 21:05:31 +11:00
parent b42f9990b5
commit 436c3d6787
10 changed files with 72 additions and 62 deletions

View File

@@ -11,23 +11,36 @@ class ResetPasswordNotification extends Notification
{
use Queueable;
public $token;
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a new notification instance.
* The callback that should be used to build the mail message.
*
* @var \Closure|null
*/
public static $toMailCallback;
/**
* Create a notification instance.
*
* @param string $token
* @return void
*/
public function __construct($token)
{
$this->token = $token;
$this->token = $token;
}
/**
* Get the notification's delivery channels.
* Get the notification's channels.
*
* @param mixed $notifiable
* @return array
* @return array|string
*/
public function via($notifiable)
{
@@ -35,18 +48,33 @@ class ResetPasswordNotification extends Notification
}
/**
* Get the mail representation of the notification.
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$logo = config('SITE_SETUP')->site_logo;
$site_name = config('SITE_SETUP')->site_name;
$reset_link = route('password.reset', $this->token, true);
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
return (new MailMessage)
->markdown('email.user.passwordreset',compact('logo','site_name','reset_link'));
return (new MailMessage)
->markdown('email.user.passwordreset',[
'site'=>config('SITE_SETUP'),
'user'=>$notifiable,
'reset_link'=>route('password.reset',$this->token,true),
]);
}
}
/**
* Set a callback that should be used when building the notification mail message.
*
* @param \Closure $callback
* @return void
*/
public static function toMailUsing($callback)
{
static::$toMailCallback = $callback;
}
}