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

hotline#98519: PreRegistration : Nanook more details with PreRegistration...

hotline#98519: PreRegistration : Nanook more details with PreRegistration Failure On Not secure password
parent d8335c74
Branches
Tags
3 merge requests!3350Hotline,!3343WIP: dev#100249: ArteVOD : add a dashboard,!3339Hotline#98519 ilsdi service preregister
Pipeline #8978 passed with stage
in 43 minutes and 15 seconds
- ticket #98519 : Pré-Inscription Nanook : Amélioration du retour d'erreur en cas de mot de passe non sécurisé
\ No newline at end of file
......@@ -34,6 +34,7 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
'PatronMaxHoldsReached' => $this->_('Quota atteint pour ce type de document.'),
'PatronHoldNoveltyRecordForbidden' => $this->_('Pas de droit de réservation pour cette nouveauté.'),
'PatronMaxHoldsNoveltyReached' => $this->_('(quotas max pour les nouveautés)'),
'PatronPasswordNotSecure' => $this->_('Le mot de passe choisi est trop simple.'),
'OpacAvailableItemNotHoldable' => $this->_('Document disponible : Pas de droit de réservation d\'un document disponible depuis l\'Opac.'),
'PatronForbiddenHold' => $this->_('Réservation interdite pour l\'abonné.'),
'RecordNotHoldableForPickupLocation' => $this->_('Exemplaire non réservable pour ce site de transfert (interdiction des transferts).'),
......@@ -375,14 +376,16 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
$url = $this->buildQueryURL(['service' => 'pre-register']);
$xml = $this->getWebClient()->postData($url, $data);
if (0 === strpos($xml, '<html>'))
return $this->_error($this->_('Échec de la préinscription, une erreur est survenue.'));
return $this->ilsdiCheckXml($xml,
'error',
$this->_('Échec de la préinscription, une erreur est survenue'));
}
if ($error = $this->_getTagData($xml, 'error'))
return $this->_error($this->_('Échec de la préinscription, le webservice a répondu "%s".',
trim($error)));
return $this->_success();
protected function _xmlError($xml){
return ($message = $this->_findErrorTagInXml($xml, 'securePasswordLabel'))
? $this->_getErrorFromCode($this->_findErrorTagInXml($xml, 'error'), '').' '.$message
: '';
}
......
......@@ -130,6 +130,7 @@ class Class_WebService_SIGB_PreRegistrationNanook extends Class_WebService_SIGB_
if(!$response['statut'])
$this->_pre_registration->addError($response['erreur']);
}
......
......@@ -439,6 +439,55 @@ class AuthControllerPreRegistrationNanookPostDispatchErrorTest
class AuthControllerPreRegistrationNanookPostDispatchErrorPatronPasswordNotSecureTest
extends AuthControllerPreRegistrationNanookTestCase {
public function setUp() {
parent::setUp();
$this->mock_web_client
->whenCalled('postData')
->with('http://super.nano.ok/ilsdi/arcadia/service/pre-register',
['site' => 1,
'lastName' => 'Jiro',
'firstName' => 'Tom',
'mail' => 'test@test.fr',
'password' => '123456',
'birthDate' => '2001-05-05',
'town' => 'titi',
'zipcode' => '123456',
'address' => '123'])
->answers('<?xml version="1.0" encoding="UTF-8"?><error>PatronPasswordNotSecure</error><securePasswordLabel>Le mot de passe doit comporter au minimum 6 caractères et doit être constitué d\'au moins un chiffre et une lettre.</securePasswordLabel>');
$this->postDispatch('/opac/auth/pre-registration', ['site' => '1',
'lastName' => 'Jiro',
'firstName' => 'Tom',
'mail' => 'test@test.fr',
'mail2' => 'test@test.fr',
'password' => '123456',
'password2' => '123456',
'birthDate' => '2001-05-05',
'town' => 'titi',
'zipcode' => '123456',
'address' => '123',
'website' => '']);
}
/** @test */
public function responseShouldRedirectToPreRegistrationErrorIdBibOne() {
$this->assertRedirectTo('http://localhost' . BASE_URL . '/auth/pre-registration/id_bib/1');
}
/** @test */
public function notifyShouldContainsLeMotDePasseChoisiNestPasSuffisamment() {
$this->assertFlashMessengerContentContains('Le mot de passe choisi est trop simple. Le mot de passe doit comporter au minimum 6 caractères et doit être constitué d\'au moins un chiffre et une lettre.' );
}
}
class AuthControllerPreRegistrationNanookPostDispatchSpamTest
extends AuthControllerPreRegistrationNanookTestCase {
......
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