ENHANCEMENT added Authenticator::$default_authenticator to enable modifying the tab-order

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44381 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-11-06 21:18:27 +00:00
parent 8b1ef652d7
commit 66ecc4e75e
2 changed files with 33 additions and 9 deletions

View File

@ -26,6 +26,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . $path);
* Register the {@link OpenIDAuthenticator OpenID authenticator}
*/
Authenticator::register_authenticator('MemberAuthenticator');
Authenticator::set_default_authenticator('MemberAuthenticator');
/**
* Define a default language different than english

View File

@ -1,13 +1,4 @@
<?php
/**
* Authenticator base class
*
* @author Markus Lanthaler <markus@silverstripe.com>
*/
/**
* Abstract base class for an authentication method
*
@ -24,6 +15,14 @@ abstract class Authenticator extends Object {
* @var array
*/
private static $authenticators = array();
/**
* Used to influence the order of authenticators on the login-screen
* (default shows first).
*
* @var string
*/
private static $default_authenticator = '';
/**
@ -110,8 +109,32 @@ abstract class Authenticator extends Object {
* authenticators.
*/
public static function get_authenticators() {
// put default authenticator first (mainly for tab-order on loginform)
if($key = array_search(self::$default_authenticator,self::$authenticators)) {
unset(self::$authenticators[$key]);
array_unshift(self::$authenticators, self::$default_authenticator);
}
return self::$authenticators;
}
/**
* Set a default authenticator (shows first in tabs)
*
* @param string
*/
public static function set_default_authenticator($authenticator) {
self::$default_authenticator = $authenticator;
}
/**
* @return string
*/
public static function get_default_authenticator() {
return self::$default_authenticator;
}
/**