silverstripe-framework/security/LoginForm.php
Ingo Schommer 069192e83c mlanthaler: Refactored the new authenticator code so that it is easier now to enable/disable different authentication methods (simple edit _config.php).
Also moved the needed change to the PHP include path to the new _config.php file so you don't need to set that anymore in mysite/_config.php. 
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41824 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-09-15 00:08:23 +00:00

48 lines
1.0 KiB
PHP

<?php
/**
* LoginForm base class
*/
/**
* Abstract base class for a login form
*
* This class is used as a base class for the different log-in forms like
* {@link MemberLoginForm} or {@link OpenIDLoginForm}.
*
* @author Markus Lanthaler <markus@silverstripe.com>
*/
abstract class LoginForm extends Form
{
/**
* Authenticator class to use with this login form
*
* Set this variable to the authenticator class to use with this login
* form.
*
* @var string
*/
protected $authenticator_class;
/**
* Get the authenticator class
*
* @return Authenticator Returns the authenticator class for this login
* form.
*/
public function getAuthenticator() {
if(!class_exists($this->authenticator_class) ||
!is_subclass_of($this->authenticator_class, 'Authenticator')) {
user_error('The form uses an invalid authenticator class!',
E_USER_ERROR);
return;
}
return new $this->authenticator_class;
}
}
?>