aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-03 18:54:45 +0200
committerGitHub <noreply@github.com>2020-09-03 18:54:45 +0200
commit2ba51040c702451fca860a1a36a1977284e21e67 (patch)
tree459857989211f31317a0d68ad897da59bd07cf03
parent46d3f8162bb7950d3c7fec78ffcc2bdaf349dced (diff)
parentd33cffdb2e195be118d99342aa42f1d15a186f27 (diff)
downloadShaarli-2ba51040c702451fca860a1a36a1977284e21e67.tar.gz
Shaarli-2ba51040c702451fca860a1a36a1977284e21e67.tar.zst
Shaarli-2ba51040c702451fca860a1a36a1977284e21e67.zip
Merge pull request #1541 from ArthurHoaro/fix/legacy-login-encoding
-rw-r--r--application/legacy/LegacyController.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/application/legacy/LegacyController.php b/application/legacy/LegacyController.php
index e16dd0f4..826604e7 100644
--- a/application/legacy/LegacyController.php
+++ b/application/legacy/LegacyController.php
@@ -39,13 +39,23 @@ class LegacyController extends ShaarliVisitorController
39 /** Legacy route: ?post= */ 39 /** Legacy route: ?post= */
40 public function post(Request $request, Response $response): Response 40 public function post(Request $request, Response $response): Response
41 { 41 {
42 $parameters = count($request->getQueryParams()) > 0 ? '?' . http_build_query($request->getQueryParams()) : '';
43 $route = '/admin/shaare'; 42 $route = '/admin/shaare';
43 $buildParameters = function (?array $parameters, bool $encode) {
44 if ($encode) {
45 $parameters = array_map('urlencode', $parameters);
46 }
47
48 return count($parameters) > 0 ? '?' . http_build_query($parameters) : '';
49 };
50
44 51
45 if (!$this->container->loginManager->isLoggedIn()) { 52 if (!$this->container->loginManager->isLoggedIn()) {
53 $parameters = $buildParameters($request->getQueryParams(), true);
46 return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters); 54 return $this->redirect($response, '/login?returnurl='. $this->getBasePath() . $route . $parameters);
47 } 55 }
48 56
57 $parameters = $buildParameters($request->getQueryParams(), false);
58
49 return $this->redirect($response, $route . $parameters); 59 return $this->redirect($response, $route . $parameters);
50 } 60 }
51 61