feat: Spamschutz für Kontakt-Widget und Registrierung mit Cloudflare Turnstile
- Turnstile für Gäste und unbestätigte Konten (TurnstileVerifier, <x-turnstile>); ist Cloudflare nicht erreichbar, wird durchgelassen und im Verlauf, in der Kontakt-Queue und in der Betriebsüberwachung markiert - Inhaltsfilter des Kontaktformulars (fremde Links, Floskel mit Seitentitel, Zeichensalat, Sperrliste, Absenden unter 3 Sekunden); Treffer landen in der Spam-Quarantäne ohne Mail, Löschung nach 30 Tagen - Admin: Filter „Spam“, Sammelaktion, „Kein Spam“ holt die Mail nach - Registrierung lehnt Zufallsnamen ab; users:prune-bot-registrations (täglicher Lauf erst mit USERS_PRUNE_BOT_REGISTRATIONS=true) - contact-messages:quarantine-spam für den Altbestand - CSP erlaubt challenges.cloudflare.com, Log-Kanal spam - Datenschutzerklärung: Abschnitt 6a Cloudflare Turnstile (Vorschlag) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
43420f0422
commit
beae7e2b13
40 changed files with 1992 additions and 40 deletions
40
app/Services/Web/ContactMessageNotifier.php
Normal file
40
app/Services/Web/ContactMessageNotifier.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Web;
|
||||
|
||||
use App\Mail\ContactRequestSubmitted;
|
||||
use App\Models\ContactMessage;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
/**
|
||||
* Benachrichtigt die Brand-Kontaktadresse über ein Kontakt-Anliegen
|
||||
* (config domains.domains.{portal}.brand.contact_email, Fallback:
|
||||
* Absenderadresse der Anwendung). Läuft beim Eingang und beim Zurückholen
|
||||
* eines Fehlalarms aus der Spam-Quarantäne.
|
||||
*/
|
||||
class ContactMessageNotifier
|
||||
{
|
||||
public function notify(ContactMessage $message, ?string $host = null): void
|
||||
{
|
||||
Mail::to($this->recipient($message))->queue((new ContactRequestSubmitted(
|
||||
senderName: (string) $message->name,
|
||||
senderEmail: (string) $message->email,
|
||||
messageText: (string) $message->message,
|
||||
host: $host ?? $this->hostOf($message),
|
||||
topicLabel: $message->topic->label(),
|
||||
pageUrl: $message->page_url,
|
||||
))->afterCommit());
|
||||
}
|
||||
|
||||
private function recipient(ContactMessage $message): string
|
||||
{
|
||||
return config('domains.domains.'.$message->portal.'.brand.contact_email')
|
||||
?? config('mail.from.address');
|
||||
}
|
||||
|
||||
private function hostOf(ContactMessage $message): string
|
||||
{
|
||||
return parse_url((string) $message->page_url, PHP_URL_HOST)
|
||||
?: (string) config('domains.domains.'.$message->portal.'.domain_name', $message->portal);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue