"Zwischen-Views" erstellt für Weiterleitung nach Login/Logout. Views einheitlich im div container class="inhalt". Error message nach fehlerhaftem login.

This commit is contained in:
2025-07-07 12:43:25 +02:00
parent b9fc6bcdd5
commit 3ce61ace17
12 changed files with 106 additions and 76 deletions

View File

@@ -47,17 +47,17 @@ class AuthController
$password = $_POST['password'];
$result = $this->model->login($email, $password);
if ($result === true) {
$_SESSION['user'] = $email;
header('Location: /bibarts/?controller=News&do=showNews');
exit();
$_SESSION['user'] = $email;
$this->view->setDoMethodName('showLoginSuccess');
} else {
$this->view->setVars([
'errors' => ['login' => is_string($result) ? $result : "Login fehlgeschlagen."],
'validData' => ['email' => $email],
'loginSuccess' => false
]);
$this->view->setDoMethodName('showLoginForm');
}
}
@@ -87,7 +87,6 @@ class AuthController
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
$this->view->setVars(['errors' => $errors, 'validData' => $data]);
$this->view->render('Auth/showRegistrationForm');
exit;
}
}
@@ -128,8 +127,7 @@ class AuthController
}
}
public function showConfirmation()
{
public function showConfirmation() {
$messages = [
'login' => "Login erfolgreich.",
'register' => "Registrierung erfolgreich.",
@@ -145,7 +143,6 @@ class AuthController
public function logout() {
unset($_SESSION['user']);
session_destroy();
header('Location: /bibarts/?controller=Auth&do=showLoginForm');
exit();
$this->view->setDoMethodName('showLogoutSuccess');
}
}