Support redirection of legacy route 'do=configure'
This commit is contained in:
parent
9e2d47e519
commit
11aa4a7a29
2 changed files with 19 additions and 0 deletions
|
@ -132,4 +132,21 @@ class LegacyController extends ShaarliVisitorController
|
|||
|
||||
return $this->redirect($response, '/feed/' . $feedType . $parameters);
|
||||
}
|
||||
|
||||
/** Legacy route: ?do=configure */
|
||||
protected function configure(Request $request, Response $response): Response
|
||||
{
|
||||
$route = '/admin/configure';
|
||||
|
||||
if (!$this->container->loginManager->isLoggedIn()) {
|
||||
return $this->redirect($response, '/login?returnurl=' . $this->getBasePath() . $route);
|
||||
}
|
||||
|
||||
return $this->redirect($response, $route);
|
||||
}
|
||||
|
||||
protected function getBasePath(): string
|
||||
{
|
||||
return $this->container->basePath ?: '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ class LegacyControllerTest extends TestCase
|
|||
['opensearch', [], '/open-search', true],
|
||||
['dailyrss', [], '/daily-rss', false],
|
||||
['dailyrss', [], '/daily-rss', true],
|
||||
['configure', [], '/login?returnurl=/subfolder/admin/configure', false],
|
||||
['configure', [], '/admin/configure', true],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue