feat(auth): harden authentication and add configurable two-factor support
This commit is contained in:
38
app/Notifications/PasswordChangedNotification.php
Normal file
38
app/Notifications/PasswordChangedNotification.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class PasswordChangedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public readonly string $ipAddress,
|
||||
public readonly string $occurredAt
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject('Your password was changed')
|
||||
->greeting('Hello '.$notifiable->first_name.',')
|
||||
->line('The password for your account was changed.')
|
||||
->line("Time: {$this->occurredAt}")
|
||||
->line("IP address: {$this->ipAddress}")
|
||||
->line('All other signed-in sessions have been ended.')
|
||||
->line('If you did not make this change, contact support immediately.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user