Registrierung und Login aufgeräumt: Felder und Fehler angepasst, Formulardaten bleiben bei Fehlern erhalten, Navigation zeigt jetzt nur noch passende Links je nach Login-Status, Passwort-Fehler verständlich auf Deutsch. Alles einheitlich und benutzerfreundlich gemacht!

This commit is contained in:
2025-07-07 14:31:32 +02:00
parent 404e846418
commit a9997b3c63
9 changed files with 124 additions and 131 deletions

View File

@@ -63,14 +63,14 @@ class AuthController
public function register() {
$data = [
'first_name' => $_POST['vorname'] ?? '',
'last_name' => $_POST['nachname'] ?? '',
'street' => $_POST['strasse'] ?? '',
'house_number' => $_POST['hausnr'] ?? '',
'postal_code' => $_POST['plz'] ?? '',
'city' => $_POST['ort'] ?? '',
'country' => $_POST['land'] ?? '',
'phone' => $_POST['tel'] ?? '',
'first_name' => $_POST['first_name'] ?? '',
'last_name' => $_POST['last_name'] ?? '',
'street' => $_POST['street'] ?? '',
'house_number' => $_POST['house_number'] ?? '',
'postal_code' => $_POST['postal_code'] ?? '',
'city' => $_POST['city'] ?? '',
'country' => $_POST['country'] ?? '',
'phone' => $_POST['phone'] ?? '',
'email' => $_POST['email'] ?? '',
'password' => $_POST['password'] ?? '',
'password_repeat' => $_POST['password_repeat'] ?? '',
@@ -80,13 +80,15 @@ class AuthController
$result = $this->model->register($data);
if ($result === true) {
$this->view->setVars(['success' => 'Registrierung erfolgreich!']);
$this->view->render('Auth/showLoginForm');
exit;
$this->view->setDoMethodName('showRegistrationSuccess');
} else {
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
if (is_array($result)) {
$errors['register'] = implode('<br>', $result);
} else {
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
}
$this->view->setVars(['errors' => $errors, 'validData' => $data]);
$this->view->render('Auth/showRegistrationForm');
$this->view->setDoMethodName('showRegistrationForm');
}
}