74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications\Customer;
|
|
|
|
use Illuminate\Auth\Notifications\ResetPassword as NotificationsResetPassword;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Symfony\Component\Mime\Email;
|
|
|
|
class ResetPassword extends NotificationsResetPassword implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public $tries = 3;
|
|
|
|
/**
|
|
* The customer firstname.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $firstname;
|
|
|
|
/**
|
|
* Reset password.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(string $token, string $firstname)
|
|
{
|
|
$this->firstname = $firstname;
|
|
|
|
parent::__construct($token);
|
|
static::$createUrlCallback = function ($notifiable, $token) {
|
|
return \url(URL::temporarySignedRoute(
|
|
'club.password.reset',
|
|
now()->addHours(24),
|
|
[
|
|
'token' => $token,
|
|
'email' => $notifiable->getEmailForPasswordReset(),
|
|
],
|
|
true
|
|
));
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Build the mail representation of the notification.
|
|
*/
|
|
public function toMail(mixed $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage())
|
|
->view([
|
|
'html' => 'notifications::email-club',
|
|
'text' => 'notifications::email-club-text',
|
|
])
|
|
->subject(trans('Mot de passe oublié - :site_name', ['site_name' => config('app.name')]))
|
|
/** @var string $firstname */
|
|
->greeting(trans('Bonjour :name,', ['name' => $this->firstname]))
|
|
->line(trans(
|
|
'Afin de réinitialiser votre mot de passe pour vous connecter :strong sur le Club des Gaulois, :endStrong cliquez sur le lien ci-dessous (lien valable 24h uniquement) :',
|
|
[
|
|
'strong' => '<strong>',
|
|
'endStrong' => '</strong>',
|
|
]
|
|
))
|
|
/** @var string $verificationUrl */
|
|
->action(trans('Réinitialisez votre mot de passe'), $this->resetUrl($notifiable))
|
|
->withSymfonyMessage(function (Email $message) {
|
|
$message->html($message->getHtmlBody(), 'utf-8');
|
|
});
|
|
}
|
|
}
|