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/src/App/Controller/AuthController.php b/src/App/Controller/AuthController.php index cd89d11..7df241d 100644 --- a/src/App/Controller/AuthController.php +++ b/src/App/Controller/AuthController.php @@ -48,7 +48,11 @@ class AuthController { $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 +77,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/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]); } + }