ldc-jeusselin/app/Notifications/Customer/ResetPassword.php
Jérémy Munsch de4dcfb283
Closes #2 and #4
- Add status checker + admin secure packages + upgrade enum + add sentry + upgrade to sitemap generator + bump to CRMV2
- Set customer role enum and user role enum
- Update customer migration to set roles
- phpcbf
- faker local to fr
- update lang
- composer update
- bump laravel ui
- Redo all user crud
- npm bump
- Create admin command
- rearrange views
- redo all auth system
- redo customer pro bo
2023-08-21 15:43:33 +02:00

64 lines
2 KiB
PHP

<?php
namespace App\Notifications\Customer;
use Illuminate\Auth\Notifications\ResetPassword as NotificationsResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
class ResetPassword extends NotificationsResetPassword
{
/**
* The callback that should be used to create the reset password URL.
*
* @var \Closure|null
*/
public static $createUrlCallback;
/**
* ResetPassword
*
* @param string $token
* @return void
*/
public function __construct(string $token)
{
parent::__construct($token);
static::$createUrlCallback = function ($notifiable, $token) {
return \url(URL::temporarySignedRoute(
'password.reset',
now()->addHours(24),
[
'token' => $token,
'email' => $notifiable->getEmailForPasswordReset(),
],
false
));
};
}
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
/** @var \App\Models\Customer\Customer $notifiable */
$resetUrl = $this->resetUrl($notifiable);
/** @var string $firstname */
$firstname = $notifiable->api_data->firstname;
return (new MailMessage())
->subject(trans("Mot de passe oublié - :siteName", ['siteName' => config('app.name')]))
/** @var string $firstname */
->greeting("Bonjour " . $firstname)
->line(trans(
"Afin réinitialiser votre mot de passe pour vous connecter à :siteName, cliquez sur le lien suivant :",
['siteName' => config('app.name')]
))
/** @var string $verificationUrl */
->action(trans('Réinitialisez votre mot de passe'), $resetUrl);
}
}