Support redirection of legacy route 'do=configure'

This commit is contained in:
ArthurHoaro 2020-09-01 10:40:35 +02:00
parent 9e2d47e519
commit 11aa4a7a29
2 changed files with 19 additions and 0 deletions

View file

@ -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 ?: '';
}
}

View file

@ -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],
];
}
}