Commit ad440aba authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'hotline#66282_probleme_activation_de_compte_sur_un_site_en_https' into 'stable'

Hotline#66282 probleme activation de compte sur un site en https

See merge request afi/opacce!2440
parents 56b7af32 d0d64bfb
- ticket #66282 : Inscription au portail : correction du lien d'activation lorsque le portail est en HTTPS
\ No newline at end of file
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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);
}
......
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