Revision: 2228
Author: andreassolberg
Date: Mon Mar 22 03:11:27 2010
Log: Adding support for adding links to login page in authsources.php
http://code.google.com/p/simplesamlphp/source/detail?r=2228
Modified:
/trunk/modules/core/lib/Auth/UserPassBase.php
/trunk/modules/core/templates/loginuserpass.php
/trunk/modules/core/www/loginuserpass.php
=======================================
--- /trunk/modules/core/lib/Auth/UserPassBase.php Wed Aug 5 00:30:43 2009
+++ /trunk/modules/core/lib/Auth/UserPassBase.php Mon Mar 22 03:11:27 2010
@@ -32,6 +32,12 @@
* 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 @@
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);
@@ -61,6 +71,13 @@
assert('is_string($forcedUsername) ||
is_null($forcedUsername)');
$this->forcedUsername = $forcedUsername;
}
+
+ /**
+ * Return login links from configuration
+ */
+ public function getLoginLinks() {
+ return $this->loginLinks;
+ }
/**
=======================================
--- /trunk/modules/core/templates/loginuserpass.php Fri Jan 29 04:59:30 2010
+++ /trunk/modules/core/templates/loginuserpass.php Mon Mar 22 03:11:27 2010
@@ -93,6 +93,18 @@
</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>');
=======================================
--- /trunk/modules/core/www/loginuserpass.php Wed Nov 18 00:15:52 2009
+++ /trunk/modules/core/www/loginuserpass.php Mon Mar 22 03:11:27 2010
@@ -18,6 +18,13 @@
/* 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 @@
$t->data['username'] = $username;
$t->data['forceUsername'] = FALSE;
}
+$t->data['links'] = $source->getLoginLinks();
$t->data['errorcode'] = $errorCode;
$t->show();
exit();
--
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en.