aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-01 10:40:35 +0200
committerArthurHoaro <arthur@hoa.ro>2020-09-01 10:40:35 +0200
commit11aa4a7a29c5a6358584ce0f63c061fdb0704b18 (patch)
treee58cd5355575a132e753a7a5466f26a7c479e92a
parent9e2d47e519783a991962e1fe2c9f28d77756ae49 (diff)
downloadShaarli-11aa4a7a29c5a6358584ce0f63c061fdb0704b18.tar.gz
Shaarli-11aa4a7a29c5a6358584ce0f63c061fdb0704b18.tar.zst
Shaarli-11aa4a7a29c5a6358584ce0f63c061fdb0704b18.zip
Support redirection of legacy route 'do=configure'
-rw-r--r--application/legacy/LegacyController.php17
-rw-r--r--tests/legacy/LegacyControllerTest.php2
2 files changed, 19 insertions, 0 deletions
diff --git a/application/legacy/LegacyController.php b/application/legacy/LegacyController.php
index 75fa9d2c..e16dd0f4 100644
--- a/application/legacy/LegacyController.php
+++ b/application/legacy/LegacyController.php
@@ -132,4 +132,21 @@ class LegacyController extends ShaarliVisitorController
132 132
133 return $this->redirect($response, '/feed/' . $feedType . $parameters); 133 return $this->redirect($response, '/feed/' . $feedType . $parameters);
134 } 134 }
135
136 /** Legacy route: ?do=configure */
137 protected function configure(Request $request, Response $response): Response
138 {
139 $route = '/admin/configure';
140
141 if (!$this->container->loginManager->isLoggedIn()) {
142 return $this->redirect($response, '/login?returnurl=' . $this->getBasePath() . $route);
143 }
144
145 return $this->redirect($response, $route);
146 }
147
148 protected function getBasePath(): string
149 {
150 return $this->container->basePath ?: '';
151 }
135} 152}
diff --git a/tests/legacy/LegacyControllerTest.php b/tests/legacy/LegacyControllerTest.php
index 2bbbb1d7..4e52f3e1 100644
--- a/tests/legacy/LegacyControllerTest.php
+++ b/tests/legacy/LegacyControllerTest.php
@@ -94,6 +94,8 @@ class LegacyControllerTest extends TestCase
94 ['opensearch', [], '/open-search', true], 94 ['opensearch', [], '/open-search', true],
95 ['dailyrss', [], '/daily-rss', false], 95 ['dailyrss', [], '/daily-rss', false],
96 ['dailyrss', [], '/daily-rss', true], 96 ['dailyrss', [], '/daily-rss', true],
97 ['configure', [], '/login?returnurl=/subfolder/admin/configure', false],
98 ['configure', [], '/admin/configure', true],
97 ]; 99 ];
98 } 100 }
99} 101}