diff --git a/VERSIONS_HOTLINE/66282 b/VERSIONS_HOTLINE/66282 new file mode 100644 index 0000000000000000000000000000000000000000..cd2558b69afe43b4ea80ce05ec38a3607c605d61 --- /dev/null +++ b/VERSIONS_HOTLINE/66282 @@ -0,0 +1 @@ + - ticket #66282 : Inscription au portail : correction du lien d'activation lorsque le portail est en HTTPS \ No newline at end of file diff --git a/library/Class/Users.php b/library/Class/Users.php index 9dc2857b98ee7c4c3a996571e88e146516cd3c1f..85420aefc61a47ab556224ae76f19472a1ec630e 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -1090,7 +1090,7 @@ class Class_Users extends Storm_Model_Abstract { $message_mail=[]; $message_mail[]=$this->_("Bonjour,"); $message_mail[]=$this->_("Vous avez fait une demande d'inscription sur le portail:").' '.$profil->getLibelle(); - $message_mail[]=$this->_("Pour activer votre compte, merci de cliquer sur le lien suivant:")." http://".$_SERVER["SERVER_NAME"].BASE_URL.'/opac/auth/activeuser?c=' . $attribs['cle']; + $message_mail[]=$this->_("Pour activer votre compte, merci de cliquer sur le lien suivant:")." ". Class_Url::absolute('/opac/auth/activeuser?c=' . $attribs['cle']); $message_mail[]=$this->_("Si vous n'êtes pas à l'origine de cette demande d'inscription, merci de ne pas tenir compte de cet e-mail, et l'inscription ne sera pas activée."); // envoi du mail de confirmation diff --git a/library/ZendAfi/Form/Register.php b/library/ZendAfi/Form/Register.php index 63f99bbff82f189e5058024ac577d2c7b9fa0090..d37f10d14330023caf35bd888137a46d331edc86 100644 --- a/library/ZendAfi/Form/Register.php +++ b/library/ZendAfi/Form/Register.php @@ -171,6 +171,8 @@ class ZendAfi_Form_RegisterOptionalLibrary extends ZendAfi_Form_RegisterOptional protected function _getOptions() { $options = parent::_getOptions(); $options['multiOptions'] = Class_Bib::findAllLabels(); + asort($options['multiOptions']); + return $options; } } diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index 710012527410d39d816800ea1e5d9ebd9ac2b93a..0db4cd1b1c00ce9ca067fc7dc6172a90075e63ac 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -1469,6 +1469,9 @@ class AuthControllerNobodyLoggedAndRegistrationAllowedWithOptionalFieldsRegister ->setCfgModulesPreferences(['fields' => 'library:optional;card_number:required;lastname:optional;firstname:optional'], 'auth', 'register'); + $this->fixture('Class_Bib', ['id' => 2, 'libelle' => 'Cran']); + $this->fixture('Class_Bib', ['id' => 3, 'libelle' => 'Annecy']); + $this->dispatch('auth/register', true); } @@ -1480,6 +1483,13 @@ class AuthControllerNobodyLoggedAndRegistrationAllowedWithOptionalFieldsRegister } + /** @test */ + public function libraryShouldBeAlphabeticallyOrdered() { + $this->assertXPathContentContains('//select[@name="id_site"]//option[1]', 'Annecy'); + $this->assertXPathContentContains('//select[@name="id_site"]//option[2]', 'Cran'); + } + + /** @test */ public function cardNumberShouldBeHereAndRequired() { $this->assertXPath('//input[@type="text"][@name="idabon"]'); @@ -1522,14 +1532,26 @@ abstract class AuthControllerNobodyLoggedRegisterActionTestCase extends AuthCont Class_AdminVar::newInstanceWithId('INTERDIRE_ENREG_UTIL', ['valeur' => 0]); } + + + protected function getSentMail() { + return $this->mock_transport->sent_mail; + } } -class AuthControllerNobodyLoggedRegisterPostRightDatasTest extends AuthControllerNobodyLoggedRegisterActionTestCase { +class AuthControllerNobodyLoggedRegisterPostRightDatasTest + extends AuthControllerNobodyLoggedRegisterActionTestCase { + protected + $_content = '', + $_from, + $_recipients; + public function setUp() { parent::setUp(); + $_SERVER['HTTPS'] = 'On'; $this->postDispatch('auth/register', ['login' => 'mario', @@ -1540,44 +1562,42 @@ class AuthControllerNobodyLoggedRegisterPostRightDatasTest extends AuthControlle 'lastname' => 'bros', 'firstname' => 'mario', 'emailCheck' => '']); - } - - - protected function getSentMail() { - return $this->mock_transport->sent_mail; - } - - protected function getSentMailRecipients() { - return $this->getSentMail()->getRecipients(); + $this->_from = $this->getSentMail()->getFrom(); + $this->_recipients = $this->getSentMail()->getRecipients(); + $this->_content = $this->getSentMail()->getBodyText(true); } - protected function getSentMailFrom() { - return $this->getSentMail()->getFrom(); - } - - - protected function getSentMailContent() { - return quoted_printable_decode($this->getSentMail()->getBodyText()->getContent()); + public function tearDown() { + unset($_SERVER['HTTPS']); + parent::tearDown(); } /** @test */ public function recipientShouldBeMario() { - $this->assertContains('mario@afi-sa.fr', $this->getSentMailRecipients()); + $this->assertContains('mario@afi-sa.fr', $this->_recipients); } + /** @test */ public function recipientsShouldContainsChefAtAfiDotFr() { - $this->assertContains('chef@afi.fr', $this->getSentMailRecipients()); + $this->assertContains('chef@afi.fr', $this->_recipients); } /** @test */ public function contentShouldContainsYouHaveRegistered() { $this->assertContains('Vous avez fait une demande d\'inscription', - $this->getSentMailContent()); + $this->_content); + } + + + /** @test */ + public function activateUrlShouldBePresent() { + $this->assertContains(Class_Url::absolute('/opac/auth/activeuser?c=12525a8e0399b302309885ea642fed3a'), + $this->_content); } @@ -1590,7 +1610,7 @@ class AuthControllerNobodyLoggedRegisterPostRightDatasTest extends AuthControlle /** @test */ public function withoutProfilMailSenderShouldBeAdmin() { - $this->assertContains('chef@afi.fr', $this->getSentMailFrom()); + $this->assertContains('chef@afi.fr', $this->_from); }