From 9f8a5f5fc42d7df86267e3dfa8b783c9e76b60cd Mon Sep 17 00:00:00 2001 From: samuel Date: Tue, 9 Jan 2024 17:13:38 +0100 Subject: [PATCH 1/2] email and username persisted and RGPD checkbox --- src/App/Controller/AuthController.php | 10 +++++++--- src/App/Views/display_register.html.twig | 13 ++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/App/Controller/AuthController.php b/src/App/Controller/AuthController.php index 7df241d..fced1d3 100644 --- a/src/App/Controller/AuthController.php +++ b/src/App/Controller/AuthController.php @@ -31,20 +31,24 @@ class AuthController { */ public function register(array $request, MutableSessionHandle $session): HttpResponse { $fails = []; - $request = HttpRequest::from($request, $fails, [ + $goodfield = []; + HttpRequest::from($request, $fails, [ "username" => [Validators::name(), Validators::lenBetween(2, 32)], "password" => [Validators::lenBetween(6, 256)], "confirmpassword" => [Validators::lenBetween(6, 256)], "email" => [Validators::email(), Validators::lenBetween(5, 256)], ]); + if (!empty($fails)) { - return ViewHttpResponse::twig("display_register.html.twig", ['fails' => $fails]); + if (!(in_array($request['username'], $fails)) or !(in_array($request['email'], $fails))) { + return ViewHttpResponse::twig("display_register.html.twig", ['fails' => $fails,'username' => $request['username'],'email' => $request['email']]); + } } + $account = $this->model->register($request['username'], $request["password"], $request['confirmpassword'], $request['email'], $fails); if (!empty($fails)) { return ViewHttpResponse::twig("display_register.html.twig", ['fails' => $fails]); } - $session->setAccount($account); $target_url = $session->getInitialTarget(); diff --git a/src/App/Views/display_register.html.twig b/src/App/Views/display_register.html.twig index 38bdb43..7b883a5 100644 --- a/src/App/Views/display_register.html.twig +++ b/src/App/Views/display_register.html.twig @@ -62,6 +62,10 @@ text-align: right; } + .consentement{ + font-size: small; + } + #buttons{ display: flex; justify-content: center; @@ -95,15 +99,18 @@ {% endfor %} - + - +

+
Vous avez déjà un compte ? -
-- 2.36.3 From 6cd52d19358efffca2e34f6e58233dc8bddafdbd Mon Sep 17 00:00:00 2001 From: samuel Date: Mon, 15 Jan 2024 10:47:45 +0100 Subject: [PATCH 2/2] PR OK --- src/App/Controller/AuthController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App/Controller/AuthController.php b/src/App/Controller/AuthController.php index fced1d3..dbb72d6 100644 --- a/src/App/Controller/AuthController.php +++ b/src/App/Controller/AuthController.php @@ -31,7 +31,6 @@ class AuthController { */ public function register(array $request, MutableSessionHandle $session): HttpResponse { $fails = []; - $goodfield = []; HttpRequest::from($request, $fails, [ "username" => [Validators::name(), Validators::lenBetween(2, 32)], "password" => [Validators::lenBetween(6, 256)], -- 2.36.3