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 ?
-