From 5a1c032f1b7298184402db00cf1e81f49774fb02 Mon Sep 17 00:00:00 2001 From: Caroline Schulte Date: Wed, 3 Jun 2026 21:27:08 +0200 Subject: [PATCH] Reviewnacharbeitung --- php/controller/register-controller.php | 84 ++++++++++---------------- php/validator/user-validator.php | 55 ++--------------- 2 files changed, 37 insertions(+), 102 deletions(-) diff --git a/php/controller/register-controller.php b/php/controller/register-controller.php index 293c099..a4d2feb 100644 --- a/php/controller/register-controller.php +++ b/php/controller/register-controller.php @@ -1,63 +1,43 @@ - -
- -
\ No newline at end of file + } catch (InvalidArgumentException $e) { + $error = $e->getMessage(); + } catch (Exception $e) { + $error = "Die Registrierung konnte nicht gespeichert werden."; + } + } +} \ No newline at end of file diff --git a/php/validator/user-validator.php b/php/validator/user-validator.php index 96db1ce..80dd996 100644 --- a/php/validator/user-validator.php +++ b/php/validator/user-validator.php @@ -1,71 +1,28 @@ = 8 && $zeichenAnzahl <= 72) { - return true; - } else { - return false; - } + return $zeichenAnzahl >= 8 && $zeichenAnzahl <= 72; } -/** - * Prüft ein optionales Passwort. - * Leeres Passwort ist erlaubt, wenn der Nutzer sein Passwort nicht ändern möchte. - * Wenn ein Passwort eingegeben wurde, gelten die normalen Passwortregeln. - * - * @param $password - * @return bool - */ function userOptionalPasswordValidator($password) { if (!isset($password) || $password === '') { @@ -73,6 +30,4 @@ function userOptionalPasswordValidator($password) } return userPasswordValidator($password); -} - -?> \ No newline at end of file +} \ No newline at end of file