aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-01 10:12:54 +0200
committerArthurHoaro <arthur@hoa.ro>2020-09-01 10:12:54 +0200
commitaca995e09cf9c210ffe45584fbe50dcedb8bdebb (patch)
treed49ca5c06948d6997f6d4da6de6fa23140a841a8 /application
parentbea062149ebcb4663861edb1cc0a32faf85b273f (diff)
downloadShaarli-aca995e09cf9c210ffe45584fbe50dcedb8bdebb.tar.gz
Shaarli-aca995e09cf9c210ffe45584fbe50dcedb8bdebb.tar.zst
Shaarli-aca995e09cf9c210ffe45584fbe50dcedb8bdebb.zip
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
Diffstat (limited to 'application')
-rw-r--r--application/legacy/LegacyController.php8
1 files changed, 5 insertions, 3 deletions
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
42 $parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : ''; 42 $parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : '';
43 43
44 if (!$this->container->loginManager->isLoggedIn()) { 44 if (!$this->container->loginManager->isLoggedIn()) {
45 return $this->redirect($response, '/login' . $parameters); 45 return $this->redirect($response, '/login?returnurl=/admin/shaare' . $parameters);
46 } 46 }
47 47
48 return $this->redirect($response, '/admin/shaare' . $parameters); 48 return $this->redirect($response, '/admin/shaare' . $parameters);
@@ -52,7 +52,7 @@ class LegacyController extends ShaarliVisitorController
52 protected function addlink(Request $request, Response $response): Response 52 protected function addlink(Request $request, Response $response): Response
53 { 53 {
54 if (!$this->container->loginManager->isLoggedIn()) { 54 if (!$this->container->loginManager->isLoggedIn()) {
55 return $this->redirect($response, '/login'); 55 return $this->redirect($response, '/login?returnurl=/admin/add-shaare');
56 } 56 }
57 57
58 return $this->redirect($response, '/admin/add-shaare'); 58 return $this->redirect($response, '/admin/add-shaare');
@@ -61,7 +61,9 @@ class LegacyController extends ShaarliVisitorController
61 /** Legacy route: ?do=login */ 61 /** Legacy route: ?do=login */
62 protected function login(Request $request, Response $response): Response 62 protected function login(Request $request, Response $response): Response
63 { 63 {
64 return $this->redirect($response, '/login'); 64 $returnurl = $request->getQueryParam('returnurl');
65
66 return $this->redirect($response, '/login' . ($returnurl ? '?returnurl=' . $returnurl : ''));
65 } 67 }
66 68
67 /** Legacy route: ?do=logout */ 69 /** Legacy route: ?do=logout */