Commit 56b58530 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction du bug de redirection vers la page demandée en cas d'authentification CAS.

parent 29ca171f
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace UnicaenAuth\Authentication; namespace UnicaenAuth\Authentication;
use Zend\Http\PhpEnvironment\Request;
use Zend\Http\PhpEnvironment\Response; use Zend\Http\PhpEnvironment\Response;
use Zend\Mvc\Application; use Zend\Mvc\Application;
use Zend\Mvc\Router\Exception; use Zend\Mvc\Router\Exception;
...@@ -55,17 +56,21 @@ class RedirectCallback ...@@ -55,17 +56,21 @@ class RedirectCallback
*/ */
private function getRedirectRouteFromRequest() private function getRedirectRouteFromRequest()
{ {
/** @var Request $request */
$request = $this->application->getRequest(); $request = $this->application->getRequest();
$redirect = $request->getQuery('redirect');
if ($redirect && $this->routeExists($redirect)) { $redirectFromQuery = $request->getQuery('redirect');
return $redirect; if ($redirectFromQuery && $this->routeExists($redirectFromQuery)) {
return $redirectFromQuery;
} }
$redirect = $request->getPost('redirect'); $redirectFromPost = $request->getPost('redirect');
if ($redirect && $this->routeExists($redirect)) { if ($redirectFromPost && $this->routeExists($redirectFromPost)) {
return $redirect; return $redirectFromPost;
} }
$redirect = $redirectFromQuery ?: $redirectFromPost;
if ($redirect) { if ($redirect) {
return $redirect; return $redirect;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment