mivita/app/Mail/MailContact.php
Kevin Adametz 4c944aa15d Spamschutz Kontakt + Registrierung: Turnstile, Rate-Limit, Honeypot; Passwort min. 8
- Kontaktformular: keine Mail mehr an die eingegebene Adresse (wurde als
  Spam-Versender missbraucht); Anfrage nur an Kontakt-Adresse + Berater (BCC),
  Reply-To = Absender; Eingaben in der Mail escaped
- Kontakt + Registrierung: Cloudflare Turnstile statt reCAPTCHA (Schluessel
  aus dem Code in die .env), Rate-Limits, Honeypot + Mindest-Ausfuellzeit,
  Namensregel (lateinische Schrift, max. 50 Zeichen), Form Requests
- Registrierung: Partner-Nummer nur fuer aktive Berater (vorher ungeprueft)
- CRM: POST /register abgeschaltet (legte ohne Captcha Benutzer an)
- Passwort-Mindestlaenge systemweit 8 Zeichen ueber Password::defaults()
- Log abgefangener Anfragen: storage/logs/form-spam-*.log
- Doku und Protokoll: dev/2026-10-09-spam/README.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 08:22:02 +00:00

59 lines
1.6 KiB
PHP

<?php
namespace App\Mail;
use App\Services\Util;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
/**
* Kontaktanfrage an mivita bzw. den Berater. Antworten gehen per Reply-To direkt an den Absender.
*/
class MailContact extends Mailable
{
use Queueable, SerializesModels;
public $user_shop;
public $subject;
public $data;
/**
* @param array<string, mixed> $data
*/
public function __construct($data)
{
$this->data = $data;
$this->user_shop = Util::getUserShop();
$this->subject = __('contact.mail_subject', ['source' => $this->source()]);
$this->replyTo($data['email'], trim(($data['first_name'] ?? '').' '.($data['last_name'] ?? '')));
}
public function build()
{
if (isset($this->data['salutation'])) {
if ($this->data['salutation'] === 'mr') {
$this->data['salutation'] = 'Herr';
}
if ($this->data['salutation'] === 'ms') {
$this->data['salutation'] = 'Frau';
}
}
return $this->view('emails.contact')->with([
'salutation' => __('contact.mail_headline'),
'copy1line' => __('contact.mail_intro', ['source' => $this->source()]),
'data' => $this->data,
'copy3line' => __('contact.mail_reply_hint'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),
]);
}
private function source(): string
{
return $this->user_shop ? $this->user_shop->slug.'.mivita.care' : 'mivita.care';
}
}