diff --git a/modules/core/lib/Auth/UserPassBase.php b/modules/core/lib/Auth/UserPassBase.php index 14d809ec217e4b5377c12ac8bdba943776153cbb..0b63e92838fcd660b8dd6102b30a8bc51d474932 100644 --- a/modules/core/lib/Auth/UserPassBase.php +++ b/modules/core/lib/Auth/UserPassBase.php @@ -32,6 +32,12 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { * If this is NULL, we won't force any username. */ private $forcedUsername; + + /** + * Links to pages from login page. + * From configuration + */ + protected $loginLinks; /** @@ -46,6 +52,10 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { public function __construct($info, &$config) { assert('is_array($info)'); assert('is_array($config)'); + + if (isset($config['core:loginpage_links'])) { + $this->loginLinks = $config['core:loginpage_links']; + } /* Call the parent constructor first, as required by the interface. */ parent::__construct($info, $config); @@ -62,6 +72,13 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { $this->forcedUsername = $forcedUsername; } + /** + * Return login links from configuration + */ + public function getLoginLinks() { + return $this->loginLinks; + } + /** * Initialize login. diff --git a/modules/core/templates/loginuserpass.php b/modules/core/templates/loginuserpass.php index 0f3da49ed7d1061fa9fcc2a1c8a03fd84eabb3a9..cff340c999b828a290985ca10326eccdc58536da 100644 --- a/modules/core/templates/loginuserpass.php +++ b/modules/core/templates/loginuserpass.php @@ -93,6 +93,18 @@ foreach ($this->data['stateparams'] as $name => $value) { </form> <?php + +if(!empty($this->data['links'])) { + echo '<ul class="links" style="margin-top: 2em">'; + foreach($this->data['links'] AS $l) { + echo '<li><a href="' . htmlspecialchars($l['href']) . '">' . htmlspecialchars($this->t($l['text'])) . '</a></li>'; + } + echo '</ul>'; +} + + + + echo('<h2>' . $this->t('{login:help_header}') . '</h2>'); echo('<p>' . $this->t('{login:help_text}') . '</p>'); diff --git a/modules/core/www/loginuserpass.php b/modules/core/www/loginuserpass.php index eb6db74480a282fd45235d08867d7a3965312f2f..44a1ae30bcc2e0f3a0e0c30e7b003c02b7461b32 100644 --- a/modules/core/www/loginuserpass.php +++ b/modules/core/www/loginuserpass.php @@ -18,6 +18,13 @@ $authStateId = $_REQUEST['AuthState']; /* Retrieve the authentication state. */ $state = SimpleSAML_Auth_State::loadState($authStateId, sspmod_core_Auth_UserPassBase::STAGEID); + +$source = SimpleSAML_Auth_Source::getById($state[sspmod_core_Auth_UserPassBase::AUTHID]); +if ($source === NULL) { + throw new Exception('Could not find authentication source with id ' . $state[sspmod_core_Auth_UserPassBase::AUTHID]); +} + + if (array_key_exists('username', $_REQUEST)) { $username = $_REQUEST['username']; } elseif (isset($state['core:username'])) { @@ -54,6 +61,7 @@ if (array_key_exists('forcedUsername', $state)) { $t->data['username'] = $username; $t->data['forceUsername'] = FALSE; } +$t->data['links'] = $source->getLoginLinks(); $t->data['errorcode'] = $errorCode; $t->show(); exit();