Skip to content
Snippets Groups Projects
Commit 60eadcb3 authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

Merge branch 'hotline#199363_reinitialisation_de_mot_de_passe' into 'master'

hotline#199363 : Nanook : Improve error management when updatePatron fails

See merge request !4993
parents 1096aeee cf8fb1b1
Branches
Tags
1 merge request!4993hotline#199363 : Nanook : Improve error management when updatePatron fails
Pipeline #33718 passed with stage
in 21 minutes and 21 seconds
- correctif #199363 : Nanook : Changement de mot de passe, afficher un message d'erreur si la modification a échouée.
\ No newline at end of file
......@@ -451,7 +451,10 @@ class AuthController extends ZendAfi_Controller_Action {
return $this->_redirect('/auth/login');
}
$this->_helper->notify($this->_('Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'));
($patron->hasErrors())
? $this->_helper->notify($this->_('La modification du mot de passe a échoué : %s', implode(BR,$patron->getErrors()) ), ['status' => 'error'])
: $this->_helper->notify($this->_('Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'));
$this->_redirect('/auth/login');
}
......
......@@ -260,3 +260,66 @@ class AuthControllerResetPasswordActionPostWithTwoUsersWithSameEmailTest
'La récupération de mot de passe n\'est pas possible pour cet email. Il est utilisé dans plusieurs comptes.');
}
}
class AuthControllerResetPasswordErrorTest extends AuthControllerResetPasswordTestCase
{
public function setUp() {
parent::setUp();
Class_HttpClientFactory::forTest();
$this->fixture(Class_IntBib::class,
['id' => 1,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => ['url_serveur' => 'https://localhost/afi_Nanook/ilsdi/']]);
$user = $this->fixture(Class_Users::class,
['id' => 12,
'prenom' => 'Valentin',
'nom' => 'Acloque',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
'id_site' => 1,
'idabon' => '45789',
'id_sigb' => '476',
'login' => 'LEC000476',
'password' => '2006',
'id_int_bib' => 1]);
$user->beAbonneSIGB()->assertSave();
Class_HttpClientFactory::getInstance()
->getLastHttpClient()
->addRequestWithResponse('https://localhost:443/afi_Nanook/ilsdi/service/AuthenticatePatron/username/LEC000476/password/2006',
false)
->addRequestWithResponse('https://localhost:443/afi_Nanook/ilsdi/service/UpdatePatronInfo/patronId/476',
'<?xml version="1.0" encoding="UTF-8"?>
<UpdatePatronInfo><error>PatronUpdateError</error></UpdatePatronInfo>');
ZendAfi_Auth::getInstance()->clearIdentity();
$token = (new Class_User_LostPass($user))->tokenAt('20171130154500');
$this->postDispatch($this->urlFor($user->getId(), $token, '20171130154500'),
['new_pass' => 'secret',
'confirm_pass' => 'secret']);
}
/** @test */
public function allHttpCallsShouldHaveBeenCalled() {
Class_HttpClientFactory::getInstance()
->getLastHttpClient()
->checkCalls($this);
}
/** @test */
public function flashMeesengerShouldContainsErrorMessage()
{
$this->assertFlashMessengerContentContains('La modification du mot de passe a échoué :');
}
}
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