Commit 4a1fe662 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] En cas de requete de connexion alors que l'utilisateur est déjà...

[FIX] En cas de requete de connexion alors que l'utilisateur est déjà authentifié, les query params 'redirect' et 'role' doivent etre pris en compte
parent 6734f54a
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -114,6 +114,14 @@ class AuthController extends AbstractActionController
    public function loginAction()
    {
        if ($this->zfcUserAuthentication()->hasIdentity()) {
            $roleId = $this->params()->fromPost('role', $this->params()->fromQuery('role', false));
            if ($roleId) {
                $this->serviceUserContext->setSelectedIdentityRole($roleId);
            }
            if ($this->getRequestedRedirect()) {
                $redirect = $this->redirectCallback;
                return $redirect();
            }
            return $this->redirect()->toRoute($this->moduleOptions->getLoginRedirectRoute());
        }

+1 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ class UserContext extends AbstractService implements EventManagerAwareInterface
    {
        if ($role) {
            if (!$this->isRoleValid($role)) {
                throw new RuntimeException("Rôle spécifié invalide.");
                throw new RuntimeException("Rôle spécifié invalide : '$role'");
            }
            if ($role instanceof RoleInterface) {
                $role = $role->getRoleId();