feat(notification): enhance password reset emails with custom templates for different scenarios

This commit is contained in:
2026-09-04 10:31:16 -03:00
parent 18f1217daa
commit 7acef66ee7
7 changed files with 113 additions and 47 deletions

View File

@@ -99,12 +99,25 @@ class NotificationMailService
: 'https://'.$recoveryDomain.$recoveryBasePath.'/recuperar-contrasena/codigo?'.http_build_query($recoveryQuery);
$brand = $tenant->websiteType ?? $tenant;
[$subject, $template] = match ($attempt->reason) {
ResetPasswordAttempt::REASON_STAFF_CREATED => [
'Tu cuenta de escáner está lista', 'scanner-created',
],
ResetPasswordAttempt::REASON_ADMINISTRATOR_CREATED => [
'Tu cuenta de administrador está lista', 'administrator-created',
],
ResetPasswordAttempt::REASON_ACCOUNT_LOCKED => [
'Desbloqueá tu cuenta', 'account-locked',
],
default => ['Código para recuperar tu contraseña', 'password-reset'],
};
$this->mailService
->forTenant($tenantCode)
->send(
$attempt->user->email,
"Código para recuperar tu contraseña - {$brand->nombre}",
view('mail.notifications.password-reset', [
"{$subject} - {$brand->nombre}",
view("mail.notifications.{$template}", [
'attempt' => $attempt,
'recoveryUrl' => $recoveryUrl,
'brand' => $brand,