Commit 4b8af499 authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

hotline #75070 : add captcha in Nanook pre-registration

parent a3eb3ce7
Pipeline #4338 passed with stage
in 35 minutes and 57 seconds
- ticket #75970 : Abonné : Pré-inscription Nanook : ajout de contre-mesures antispam
\ No newline at end of file
......@@ -25,7 +25,6 @@ class ZendAfi_Form_PreRegistration_Nanook extends ZendAfi_Form {
parent::init();
$this
->addElement('select',
'site',
['label' => $this->_('Médiathèque'),
......@@ -56,6 +55,10 @@ class ZendAfi_Form_PreRegistration_Nanook extends ZendAfi_Form {
'allowEmpty' => false,
'validators' => [new ZendAfi_Validate_MailEquals('mail')]])
->addElement('text',
'emailCheck',
['data-spambots' => 'true'])
->addElement('password',
'password',
['label' => $this->_('Mot de passe'),
......
......@@ -319,6 +319,12 @@ class AuthControllerPreRegistrationNanookDispatchTest
public function selectSiteShouldContainsOptionAcardia() {
$this->assertXPathContentContains('//form//select[@name="site"]//option[@value="1"]', 'Arcadia');
}
/** @test */
public function formShouldContainsCaptcha() {
$this->assertXPath('//input[@name="emailCheck"]');
}
}
......@@ -353,7 +359,8 @@ class AuthControllerPreRegistrationNanookPostDispatchTest
'birthDate' => '2001-05-05',
'town' => 'titi',
'zipcode' => '123456',
'address' => '123']);
'address' => '123',
'emailCheck' => '']);
}
......@@ -419,7 +426,8 @@ class AuthControllerPreRegistrationNanookPostDispatchErrorTest
'birthDate' => '2001-05-05',
'town' => 'titi',
'zipcode' => '123456',
'address' => '123']);
'address' => '123',
'emailCheck' => '']);
}
......@@ -431,6 +439,35 @@ class AuthControllerPreRegistrationNanookPostDispatchErrorTest
class AuthControllerPreRegistrationNanookPostDispatchSpamTest
extends AuthControllerPreRegistrationNanookTestCase {
public function setUp() {
parent::setUp();
$this->postDispatch('/opac/auth/pre-registration', ['site' => '1',
'lastName' => 'Jiro',
'firstName' => 'Tom',
'mail' => 'test@test.fr',
'mail2' => 'test@test.fr',
'password' => 'pwd123456',
'password2' => 'pwd123456',
'birthDate' => '2001-05-05',
'town' => 'titi',
'zipcode' => '123456',
'address' => '123',
'emailCheck' => 'russian-pal@poutine.ru']);
}
/** @test */
public function shouldRedirectToHome() {
$this->assertRedirectTo('/');
}
}
class AuthControllerPreRegistrationWithNoPreRegistrationTest extends AuthControllerPreRegistrationNanookTestCase {
public function setUp() {
......
Markdown is supported
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