From aca995e09cf9c210ffe45584fbe50dcedb8bdebb Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 1 Sep 2020 10:12:54 +0200 Subject: Fix support for legacy route login redirection Makes sure that the user is properly redirected to the bookmark form after login, even with legacy routes --- application/legacy/LegacyController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'application/legacy/LegacyController.php') diff --git a/application/legacy/LegacyController.php b/application/legacy/LegacyController.php index 26465d2c..efc14409 100644 --- a/application/legacy/LegacyController.php +++ b/application/legacy/LegacyController.php @@ -42,7 +42,7 @@ class LegacyController extends ShaarliVisitorController $parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : ''; if (!$this->container->loginManager->isLoggedIn()) { - return $this->redirect($response, '/login' . $parameters); + return $this->redirect($response, '/login?returnurl=/admin/shaare' . $parameters); } return $this->redirect($response, '/admin/shaare' . $parameters); @@ -52,7 +52,7 @@ class LegacyController extends ShaarliVisitorController protected function addlink(Request $request, Response $response): Response { if (!$this->container->loginManager->isLoggedIn()) { - return $this->redirect($response, '/login'); + return $this->redirect($response, '/login?returnurl=/admin/add-shaare'); } return $this->redirect($response, '/admin/add-shaare'); @@ -61,7 +61,9 @@ class LegacyController extends ShaarliVisitorController /** Legacy route: ?do=login */ protected function login(Request $request, Response $response): Response { - return $this->redirect($response, '/login'); + $returnurl = $request->getQueryParam('returnurl'); + + return $this->redirect($response, '/login' . ($returnurl ? '?returnurl=' . $returnurl : '')); } /** Legacy route: ?do=logout */ -- cgit v1.2.3