From 12890293e0d82855e09744f294e6e661d8fefb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sat, 8 Apr 2023 20:54:18 +0200 Subject: [PATCH] fix redirect again - hopefully last time --- public/index.php | 2 +- src/Controller/LoginController.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/index.php b/public/index.php index e6c1b6a..f8b38bd 100644 --- a/public/index.php +++ b/public/index.php @@ -29,7 +29,7 @@ if ($match !== null) { } if (!$authorized) { - Container::$request->session()->set('redirect_after_login', '/' . $url); + Container::$request->session()->set('redirect_after_login', $url); $response = new Redirect(Container::$routeCollection->getRoute('login')->generateLink(), IRedirect::TEMPORARY); header('Location: ' . $response->getUrl(), true, $response->getHttpCode()); return; diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index 9c2445b..34baae4 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -47,7 +47,7 @@ class LoginController return new Redirect($this->redirectUrl, IRedirect::TEMPORARY); } - return new HtmlContent('login/login', ['redirectUrl' => $this->redirectUrl]); + return new HtmlContent('login/login', ['redirectUrl' => '/' . $this->redirectUrl]); } public function getGoogleLoginRedirect(): IRedirect @@ -99,7 +99,7 @@ class LoginController $user = $this->userRepository->getById($resetter->getUserId()); - return new HtmlContent('login/reset_password', ['success' => true, 'token' => $token, 'email' => $user->getEmail(), 'redirectUrl' => $this->redirectUrl]); + return new HtmlContent('login/reset_password', ['success' => true, 'token' => $token, 'email' => $user->getEmail(), 'redirectUrl' => '/' . $this->redirectUrl]); } public function login(): IContent @@ -183,7 +183,7 @@ class LoginController $this->deleteRedirectUrl(); return new JsonContent([ 'redirect' => [ - 'target' => $this->redirectUrl + 'target' => '/' . $this->redirectUrl ] ]); } @@ -247,7 +247,7 @@ class LoginController $this->deleteRedirectUrl(); return new JsonContent([ 'redirect' => [ - 'target' => $this->redirectUrl + 'target' => '/' . $this->redirectUrl ] ]); } -- 2.45.2