From 17eb5a318e616d1c739e302edab102ca9706eb3a Mon Sep 17 00:00:00 2001
From: Laurent Laffont <llaffont@afi-sa.fr>
Date: Wed, 31 May 2017 17:12:04 +0200
Subject: [PATCH] dev #40971 fix redirect after successful secure password

---
 application/modules/opac/controllers/AuthController.php   | 8 ++++----
 .../opac/controllers/AuthControllerWithNanookTest.php     | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php
index e3d74eeccc3..9220f7e5c74 100644
--- a/application/modules/opac/controllers/AuthController.php
+++ b/application/modules/opac/controllers/AuthController.php
@@ -129,9 +129,8 @@ class AuthController extends ZendAfi_Controller_Action {
     $current_password = $this->_request->getPost('current_password');
 
     $form = $this->_setupSecurePasswordForm();
-    if (!$form->isValid($this->_request->getPost())) {
-      return $this->renderScript('auth/secure-password.phtml');;
-    }
+    if (!$form->isValid($this->_request->getPost()))
+      return $this->renderScript('auth/secure-password.phtml');
 
     if (!ZendAfi_Auth::getInstance()->authenticateLoginPassword($card, $current_password)) {
       $form->card->addError($this->_('Numéro de carte incorrect'));
@@ -147,7 +146,8 @@ class AuthController extends ZendAfi_Controller_Action {
     ZendAfi_Auth::getInstance()->clearIdentity();
     $this->getHelper('notify')->bePopup();
     $this->_helper->notify($this->_('Votre compte est sécurisé. Vous pouvez maintenant vous connecter avec votre courriel et votre nouveau mot de passe.'));
-    $this->_redirect(Class_Url::baseUrl());
+
+    $this->_redirect('/');
   }
 
 
diff --git a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php
index b3d645a53ff..275ecc02244 100644
--- a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php
+++ b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php
@@ -177,7 +177,7 @@ class AuthControllerWithNanookPostSecurePasswordWithMailAndUnsecurePassword
 
   /** @test */
   public function responseShouldRedirect() {
-    $this->assertRedirectTo(Class_Url::baseUrl());
+    $this->assertRedirectTo('/');
   }
 
 
-- 
GitLab