diff --git a/front/assets/court/court.svg b/front/assets/court/court.svg deleted file mode 100644 index e01fd58..0000000 --- a/front/assets/court/court.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/front/views/Editor.tsx b/front/views/Editor.tsx index cee7b98..cbb2da5 100644 --- a/front/views/Editor.tsx +++ b/front/views/Editor.tsx @@ -32,7 +32,7 @@ import { CourtAction } from "./editor/CourtAction" import { BasketCourt } from "../components/editor/BasketCourt" import { ratioWithinBase } from "../components/arrows/Pos" import { Action, ActionKind } from "../model/tactic/Action" -import {BASE} from "../Constants"; +import { BASE } from "../Constants" const ERROR_STYLE: CSSProperties = { borderColor: "red", @@ -399,7 +399,7 @@ function EditorView({ Home
- +
*/} { location.pathname = BASE + "/settings" }} diff --git a/public/account.svg b/public/account.svg deleted file mode 100644 index 70d7391..0000000 --- a/public/account.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/App/Controller/AuthController.php b/src/App/Controller/AuthController.php index 4d9eebe..386f896 100644 --- a/src/App/Controller/AuthController.php +++ b/src/App/Controller/AuthController.php @@ -31,24 +31,31 @@ class AuthController { */ public function register(array $request, MutableSessionHandle $session): HttpResponse { $fails = []; - $request = HttpRequest::from($request, $fails, [ - "username" => [DefaultValidators::name(), DefaultValidators::lenBetween(2, 32)], - "password" => [DefaultValidators::lenBetween(6, 256)], - "confirmpassword" => [DefaultValidators::lenBetween(6, 256)], - "email" => [DefaultValidators::email(), DefaultValidators::lenBetween(5, 256)], + 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(); - return HttpResponse::redirect($target_url ?? "/home"); + if ($target_url != null) { + return HttpResponse::redirect_absolute($target_url); + } + + return HttpResponse::redirect("/home"); } @@ -73,7 +80,11 @@ class AuthController { $target_url = $session->getInitialTarget(); $session->setInitialTarget(null); - return HttpResponse::redirect($target_url ?? "/home"); + if ($target_url != null) { + return HttpResponse::redirect_absolute($target_url); + } + + return HttpResponse::redirect("/home"); } } 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 ? -
diff --git a/src/App/react-display-file.php b/src/App/react-display-file.php index 7b09417..2dfcd11 100755 --- a/src/App/react-display-file.php +++ b/src/App/react-display-file.php @@ -31,7 +31,6 @@ height: 100%; width: 100%; margin: 0; - overflow: hidden; } diff --git a/src/Core/Gateway/TeamGateway.php b/src/Core/Gateway/TeamGateway.php index 02b1746..a817687 100644 --- a/src/Core/Gateway/TeamGateway.php +++ b/src/Core/Gateway/TeamGateway.php @@ -123,13 +123,19 @@ class TeamGateway { ); } + /** - * Get all the user's teams - * @param integer $user - * @return array> + * @param int $user + * @return array */ public function getAll(int $user): array { - return $this->con->fetch("SELECT * FROM Team", []); + return $this->con->fetch( + "SELECT t.* FROM team t,Member m WHERE m.id_team = t.id AND m.id_user= :idUser ", + [ + "idUser" => [$user, PDO::PARAM_INT], + ] + ); } + } diff --git a/src/Core/Http/HttpResponse.php b/src/Core/Http/HttpResponse.php index eb52ccc..c98a261 100644 --- a/src/Core/Http/HttpResponse.php +++ b/src/Core/Http/HttpResponse.php @@ -42,11 +42,24 @@ class HttpResponse { * @param int $code only HTTP 3XX codes are accepted. * @return HttpResponse a response that will redirect client to given url */ + public static function redirect(string $url, int $code = HttpCodes::FOUND): HttpResponse { + global $basePath; + return self::redirect_absolute($basePath . $url, $code); + } + + /** + * @param string $url the url to redirect + * @param int $code only HTTP 3XX codes are accepted. + * @return HttpResponse a response that will redirect client to given url + */ + + public static function redirect_absolute(string $url, int $code = HttpCodes::FOUND): HttpResponse { if ($code < 300 || $code >= 400) { throw new \InvalidArgumentException("given code is not a redirection http code"); } return new HttpResponse($code, ["Location" => $url]); } + }