Commit 2dc6c6b3 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'hotline#109177_pb_lien_skilleos_sso_bootstrap' into 'hotline'

hotline#109177 : Intonation Theme : Skilleos redirection was broken

See merge request !3499
parents 1c662f1a 6938aeba
Pipeline #10039 canceled with stage
in 3 minutes and 13 seconds
- ticket #109177 : Pb lien Skilléos (sso + bootstrap)
\ No newline at end of file
......@@ -97,14 +97,16 @@ abstract class IntonationLoginRenderAbstract {
foreach($this->_settings->toArray() as $key => $value)
if (is_string($value) || is_int($value))
$options [Storm_Inflector::underscorize($key)] = $value;
$form = ZendAfi_Form_Login::newWithOptions(['data' => $options]);
$action = $this->_settings->getClearAction()
? ''
: $this->_view->url(['controller' => 'auth',
'action' => 'login',
'redirect' => Class_Url::absolute()], null, true);
'redirect' => (isset($options['redirect_url']))
? $options['redirect_url']
: Class_Url::absolute()]
, null, true);
$form
->setAction($action);
......
......@@ -24,7 +24,12 @@ class Intonation_View_Widget_Login extends ZendAfi_View_Helper_BaseHelper {
public function Widget_Login($settings) {
$preferences = $settings->getPreferences();
$preferences[Class_Template::current()->withNameSpace('form_style')] = '';
$login = (new Intonation_Library_Widget_Login_View($this->view->id_module, $preferences))
$login = (new Intonation_Library_Widget_Login_View($this->view->id_module,
array_merge(
$preferences,
($settings->getFormOptions() && isset($settings->getFormOptions()['data']))
? $settings->getFormOptions()['data']
:[])))
->setView($this->view);
$login->getHtml();
return $login->getContent();
......
......@@ -4902,6 +4902,28 @@ class TemplatesDispatchIntonationAuthLoginTest extends TemplatesIntonationTestCa
class TemplatesDispatchIntonationAuthLoginWithRedirectTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
ZendAfi_Auth::getInstance()->clearIdentity();
$this->dispatch('/opac/auth/login/id_profil/72?redirect='.urlencode('http://mybib/modules/skilleos'));
}
/** @test */
public function formActionShouldContainsRedirectUrlMyBib() {
$this->assertXPath('//form[contains(@action, "/auth/login/redirect/'.urlencode("http://mybib/modules/skilleos").'")]', $this->_response->getBody());
}
/** @test */
public function inputTypeHiddenShouldContainsRedirectUrlMyBib() {
$this->assertXPath('//input[@type="hidden"][@name="redirect"][@value="http://mybib/modules/skilleos"]', $this->_response->getBody());
}
}
class TemplatesDispatchNewsletterWidgetTest extends TemplatesIntonationTestCase {
/** @test */
......
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