- 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>
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Register;
|
|
|
|
use App\Rules\PersonName;
|
|
use App\Rules\TurnstileToken;
|
|
use App\Services\FormSpamGuard;
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class RegisterUserRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'salutation' => ['required', 'in:mr,ms'],
|
|
'first_name' => ['required', 'string', new PersonName],
|
|
'last_name' => ['required', 'string', new PersonName],
|
|
'email' => ['required', 'string', 'email:filter', 'max:255', 'unique:users'],
|
|
'email-confirm' => ['required', 'same:email'],
|
|
'password' => ['required', 'string', 'max:255', 'confirmed', Password::defaults()],
|
|
'password_confirmation' => ['required', 'string'],
|
|
'accepted_data_protection' => ['accepted'],
|
|
'from_member_id' => ['nullable', 'string', 'max:20'],
|
|
'cf-turnstile-response' => ['required', new TurnstileToken($this->ip())],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'cf-turnstile-response.required' => __('form_protection.captcha_failed'),
|
|
];
|
|
}
|
|
|
|
protected function failedValidation(Validator $validator): void
|
|
{
|
|
FormSpamGuard::log($this, 'register', 'validation', ['fields' => array_keys($validator->failed())]);
|
|
|
|
parent::failedValidation($validator);
|
|
}
|
|
}
|