diff --git a/VERSIONS_HOTLINE/90710 b/VERSIONS_HOTLINE/90710 new file mode 100644 index 0000000000000000000000000000000000000000..754f7e75168b0dc0b4d9885ee62e7d8ad67c74af --- /dev/null +++ b/VERSIONS_HOTLINE/90710 @@ -0,0 +1 @@ + - ticket #90710 : SIGB Nanook : Correction de la prise en compte de la sécurisation des mots de passe \ No newline at end of file diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index baf61e83057a866a8a98a3fd0ce628e42efc53a1..a8c1cc030263c83714fd7ea075ae857392eb7675 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -143,15 +143,29 @@ class AuthController extends ZendAfi_Controller_Action { } $user = Class_Users::getIdentity(); - $user->getFicheSIGB(); // init sigb infos - $user - ->setPassword($this->_request->getPost('secure_password')) - ->save(); + $user->setPassword($this->_request->getPost('secure_password')); - $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.')); + try { + if ($user->save()) { + $patron = $user->getEmprunteur(); + $patron->setPassword($this->_request->getPost('secure_password')); + $patron->ensureService($user)->save(); + + $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('/'); + } + + $form->addDecorator('Errors'); + foreach($user->getErrors() as $error) + $form->addError($error); + + } catch(Exception $e) { + $form->addError($e->getMessage()); + $form->addDecorator('Errors'); + } - $this->_redirect('/'); + return $this->renderScript('auth/secure-password.phtml'); } diff --git a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php index f60991fb2144a922cc61178c975f82bd05a60479..9f0c5e75484c426665bd7fc17d71238b82f1e8e4 100644 --- a/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerWithNanookTest.php @@ -181,6 +181,12 @@ class AuthControllerWithNanookPostSecurePasswordWithMailAndUnsecurePassword } + /** @test @see http://forge.afi-sa.fr/issues/90710 */ + public function nanookShouldHaveBeenCalled() { + $this->assertTrue($this->_web_client->methodHasBeenCalled('postData')); + } + + /** @test */ public function usersZBTIC1234ShouldHavePasswordRoxor() { $this->assertNotNull(Class_Users::findFirstBy(['login' => 'ZBTIC1234',