aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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}