From d711bc6152d6b1199054752843bbd736e6411880 Mon Sep 17 00:00:00 2001 From: Karsten Tlotzek Date: Mon, 30 Jun 2025 14:10:40 +0200 Subject: [PATCH] Add registration functionality and update authentication views - Implemented a new method in AuthController to display the registration form with localized labels and session error handling. - Updated the login view to include a link for account creation. - Enhanced the registration view with a link to the login form. - Removed the obsolete showRegisterPage view to streamline the codebase. --- Controller/AuthController.php | 15 +++++++++++++++ Views/Auth/login.phtml | 3 +++ Views/Auth/register.phtml | 4 ++++ Views/Auth/showAuthForm.phtml | 2 +- .../showRegistrationForm.phtml} | 3 ++- 5 files changed, 25 insertions(+), 2 deletions(-) rename Views/{Register/showRegisterPage.phtml => Auth/showRegistrationForm.phtml} (93%) diff --git a/Controller/AuthController.php b/Controller/AuthController.php index 614c4ef..78e8511 100644 --- a/Controller/AuthController.php +++ b/Controller/AuthController.php @@ -30,6 +30,21 @@ class AuthController unset($_SESSION['auth_errors'], $_SESSION['auth_validData']); } + public function showRegistrationForm() + { + $this->view->setVars([ + 'labels' => [ + "email" => "E-Mail-Adresse", + "password" => "Passwort", + "password_repeat" => "Passwort wiederholen", + "old_password" => "Altes Passwort" + ], + 'errors' => $_SESSION['auth_errors'] ?? [], + 'validData' => $_SESSION['auth_validData'] ?? [] + ]); + unset($_SESSION['auth_errors'], $_SESSION['auth_validData']); + } + public function login() { $email = $_POST['email']; $password = $_POST['password']; diff --git a/Views/Auth/login.phtml b/Views/Auth/login.phtml index 14e1532..374f0f2 100644 --- a/Views/Auth/login.phtml +++ b/Views/Auth/login.phtml @@ -28,6 +28,9 @@ include dirname(__DIR__).'/header.phtml'; +
+ +
diff --git a/Views/Auth/register.phtml b/Views/Auth/register.phtml index 4d2f91c..9161031 100644 --- a/Views/Auth/register.phtml +++ b/Views/Auth/register.phtml @@ -58,4 +58,8 @@ +
+ +
+ \ No newline at end of file diff --git a/Views/Auth/showAuthForm.phtml b/Views/Auth/showAuthForm.phtml index 3418048..2d76e8e 100644 --- a/Views/Auth/showAuthForm.phtml +++ b/Views/Auth/showAuthForm.phtml @@ -17,7 +17,7 @@ include dirname(__DIR__) . '/header.phtml'; Passwort vergessen? - Konto erstellen + Konto erstellen diff --git a/Views/Register/showRegisterPage.phtml b/Views/Auth/showRegistrationForm.phtml similarity index 93% rename from Views/Register/showRegisterPage.phtml rename to Views/Auth/showRegistrationForm.phtml index 278849f..342e1c2 100644 --- a/Views/Register/showRegisterPage.phtml +++ b/Views/Auth/showRegistrationForm.phtml @@ -60,7 +60,8 @@ include dirname(__DIR__) . '/header.phtml'; - Login +
+