Merge pull request #1541 from ArthurHoaro/fix/legacy-login-encoding
This commit is contained in:
commit
2ba51040c7
1 changed files with 11 additions and 1 deletions
|
@ -39,13 +39,23 @@ public function process(Request $request, Response $response, string $action): R
|
||||||
/** Legacy route: ?post= */
|
/** Legacy route: ?post= */
|
||||||
public function post(Request $request, Response $response): Response
|
public function post(Request $request, Response $response): Response
|
||||||
{
|
{
|
||||||
$parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : '';
|
|
||||||
$route = '/admin/shaare';
|
$route = '/admin/shaare';
|
||||||
|
$buildParameters = function (?array $parameters, bool $encode) {
|
||||||
|
if ($encode) {
|
||||||
|
$parameters = array_map('urlencode', $parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($parameters) > 0 ? '?' . http_build_query($parameters) : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!$this->container->loginManager->isLoggedIn()) {
|
if (!$this->container->loginManager->isLoggedIn()) {
|
||||||
|
$parameters = $buildParameters($request->getQueryParams(), true);
|
||||||
return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters);
|
return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters = $buildParameters($request->getQueryParams(), false);
|
||||||
|
|
||||||
return $this->redirect($response, $route . $parameters);
|
return $this->redirect($response, $route . $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue