- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
2.0 KiB
PHP
52 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\Setting;
|
|
use Illuminate\Auth\Notifications\ResetPassword;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
class ResetPasswordNotification extends ResetPassword
|
|
{
|
|
public function toMail($notifiable): MailMessage
|
|
{
|
|
$url = $this->resetUrl($notifiable);
|
|
$appName = config('app.name');
|
|
$locale = $notifiable->locale ?? app()->getLocale();
|
|
|
|
// Versuche den vom Admin angepassten E-Mail-Text zu laden
|
|
$customBody = Setting::get('password_reset_email_' . $locale)
|
|
?: Setting::get('password_reset_email_de');
|
|
|
|
// Bereinige HTML-Tags für die E-Mail (einfacher Text aus Rich-Text)
|
|
if ($customBody && strip_tags($customBody) !== '') {
|
|
$plainBody = strip_tags(str_replace(['<br>', '<br/>', '<br />', '</p>'], "\n", $customBody));
|
|
$plainBody = str_replace(
|
|
['{name}', '{app_name}', '{link}'],
|
|
[$notifiable->name, $appName, $url],
|
|
$plainBody
|
|
);
|
|
|
|
$lines = array_filter(array_map('trim', explode("\n", $plainBody)));
|
|
|
|
$mail = (new MailMessage)
|
|
->subject(__('passwords.reset_subject', ['app' => $appName], $locale));
|
|
|
|
foreach ($lines as $line) {
|
|
$mail->line($line);
|
|
}
|
|
|
|
return $mail->action(__('auth_ui.reset_password_button', [], $locale), $url);
|
|
}
|
|
|
|
// Fallback: Standard-Laravel-Template
|
|
return (new MailMessage)
|
|
->subject(__('passwords.reset_subject', ['app' => $appName], $locale))
|
|
->greeting(__('passwords.reset_greeting', ['name' => $notifiable->name], $locale))
|
|
->line(__('passwords.reset_line1', [], $locale))
|
|
->action(__('auth_ui.reset_password_button', [], $locale), $url)
|
|
->line(__('passwords.reset_line2', ['count' => config('auth.passwords.users.expire')], $locale))
|
|
->line(__('passwords.reset_line3', [], $locale));
|
|
}
|
|
}
|