honeypotField();
if ($csrfToken === '') {
$csrfToken = bin2hex(random_bytes(16));
$_SESSION['forgot_password_form_token'] = $csrfToken;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = trim((string) ($_POST['username'] ?? ''));
$postedToken = (string) ($_POST['csrf_token'] ?? '');
if ($postedToken === '' || !hash_equals($csrfToken, $postedToken)) {
$error = 'Die Formularprüfung ist fehlgeschlagen. Bitte versuche es erneut.';
} else {
$protection = $formProtection->guard('password_reset', $_POST);
if (!($protection['success'] ?? false)) {
$error = implode(' ', array_map('strval', (array) ($protection['errors'] ?? [])));
} else {
$origin = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http') . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
$result = $registration->sendPasswordReset($username, $origin);
if ($result['success'] ?? false) {
$message = (string) ($result['message'] ?? '');
$csrfToken = bin2hex(random_bytes(16));
$_SESSION['forgot_password_form_token'] = $csrfToken;
} else {
$error = (string) ($result['message'] ?? '');
}
}
}
}
?>
Passwort vergessen
Kusche.Berlin
Passwort vergessen
Gib deinen Benutzernamen an. Wenn für das Konto eine E-Mail-Adresse hinterlegt ist, senden wir einen 8 Stunden gültigen Link zum Zurücksetzen.
= htmlspecialchars($message, ENT_QUOTES) ?>
= htmlspecialchars($error, ENT_QUOTES) ?>