- AuthenticateSession in the web group logs out a user's other sessions when their password changes. - Set-password links made by an admin use a new admin_links broker with its own password_setup_tokens table and a 72-hour expiry, so links handed over by hand don't expire in an hour. Forgot-password links keep 60 minutes. The reset page accepts both, and issuing or using a link ends the user's earlier links. - Admin links are emailed with PasswordSetupLinkNotification; the email body is shared with the forgot-password email via PasswordLinkMail. - Spec chapter 3 and CLAUDE.md describe the link lifetimes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
29 lines
968 B
PHP
29 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Modules\Users\Infrastructure\Auth;
|
|
|
|
use Illuminate\Contracts\Auth\CanResetPassword;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
/**
|
|
* The "set your password" email, shared by forgot-password links and links
|
|
* made by an admin. Only the expiry line differs.
|
|
*/
|
|
final class PasswordLinkMail
|
|
{
|
|
public static function build(CanResetPassword $user, string $token, string $expiryLine): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject(__('users.password_mail.subject'))
|
|
->greeting(__('users.password_mail.greeting'))
|
|
->line(__('users.password_mail.intro'))
|
|
->action(__('users.password_mail.action'), route('password.reset', [
|
|
'token' => $token,
|
|
'email' => $user->getEmailForPasswordReset(),
|
|
]))
|
|
->line($expiryLine)
|
|
->line(__('users.password_mail.ignore'))
|
|
->salutation(config('app.name'));
|
|
}
|
|
}
|