Stand: SMTP-Test, Admin-Mail-Tab, Notifiable-Fix, Lazy-Quill
- 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>
This commit is contained in:
51
app/Notifications/ResetPasswordNotification.php
Normal file
51
app/Notifications/ResetPasswordNotification.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user