diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index 9220f7e5c74898750773d771ecdea6f9b71e2c6e..5a1d080547ed8dc8af8f86441b3714e897011d94 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -143,7 +143,6 @@ class AuthController extends ZendAfi_Controller_Action { ->setPassword($this->_request->getPost('secure_password')) ->save(); - 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.')); diff --git a/library/ZendAfi/Form/SecurePassword.php b/library/ZendAfi/Form/SecurePassword.php index 77dba675900f886e8fd1998463226cbd39cc38f6..0e72f86d69de36c4e4788e3b9a60673ead3648f3 100644 --- a/library/ZendAfi/Form/SecurePassword.php +++ b/library/ZendAfi/Form/SecurePassword.php @@ -21,23 +21,15 @@ class ZendAfi_Form_SecurePassword extends ZendAfi_Form { - public function init() { parent::init(); + $this->addElement('text', 'card', ['label' => $this->_('Numéro de carte'), 'required' => true, 'allowEmpty' => false]) - ->addElement('password', - 'current_password', - ['label' => $this->_('Mot de passe actuel'), - 'required' => true, - 'renderPassword' => true, - 'readonly' => 'readonly', - 'allowEmpty' => false]) - ->addElement('password', 'secure_password', ['label' => $this->_('Nouveau mot de passe'), @@ -53,6 +45,7 @@ class ZendAfi_Form_SecurePassword extends ZendAfi_Form { 'allowEmpty' => false, 'validators' => [new ZendAfi_Validate_PasswordEquals('secure_password')]]) + ->addElement('hidden', 'current_password') ->addElement('hidden', 'password_hint') ->addElement('hidden', 'pattern') @@ -61,4 +54,3 @@ class ZendAfi_Form_SecurePassword extends ZendAfi_Form { ['legend' => '']); } } -?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php index 275ecc02244417ffd0b56ad3b6b839d93acbfab1..f60991fb2144a922cc61178c975f82bd05a60479 100644 --- a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php @@ -115,7 +115,7 @@ class AuthControllerWithNanookPostLoginWithMailAndUnsecurePassword /** @test */ public function formShouldContainsCurrentPasswordField() { - $this->assertXPath('//form//input[@type="password"][@name="current_password"][@readonly][@value="1987"]'); + $this->assertXPath('//form//input[@type="hidden"][@name="current_password"][@value="1987"]'); } @@ -195,8 +195,8 @@ class AuthControllerWithNanookPostSecurePasswordWithMailAndUnsecurePassword /** @test */ - public function userShouldNotBeConnected() { - $this->assertNull(Class_Users::getIdentity()); + public function userShouldBeConnected() { + $this->assertNotNull(Class_Users::getIdentity()); } } @@ -232,7 +232,7 @@ class AuthControllerWithNanookPostDoSecurePasswordWithWrongCard /** @test */ public function passwordShouldContains1987() { - $this->assertXPath('//form//input[@type="password"][@name="current_password"][@value="1987"]'); + $this->assertXPath('//form//input[@type="hidden"][@name="current_password"][@value="1987"]'); }