mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
0b1f297873
Conflicts: .travis.yml README.md admin/code/LeftAndMain.php admin/css/screen.css admin/scss/screen.scss api/RestfulService.php conf/ConfigureFromEnv.php control/injector/ServiceConfigurationLocator.php control/injector/SilverStripeServiceConfigurationLocator.php core/ClassInfo.php core/Object.php css/AssetUploadField.css css/ComplexTableField_popup.css dev/CSSContentParser.php dev/DevelopmentAdmin.php docs/en/changelogs/index.md docs/en/misc/contributing/code.md docs/en/reference/execution-pipeline.md filesystem/GD.php filesystem/ImagickBackend.php filesystem/Upload.php forms/Form.php forms/FormField.php forms/HtmlEditorConfig.php forms/gridfield/GridFieldDetailForm.php forms/gridfield/GridFieldSortableHeader.php lang/en.yml model/Aggregate.php model/DataList.php model/DataObject.php model/DataQuery.php model/Image.php model/MySQLDatabase.php model/SQLQuery.php model/fieldtypes/HTMLText.php model/fieldtypes/Text.php scss/AssetUploadField.scss search/filters/SearchFilter.php security/Authenticator.php security/LoginForm.php security/Member.php security/MemberAuthenticator.php security/MemberLoginForm.php security/Security.php tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsFormsContext.php tests/control/HTTPTest.php tests/control/RequestHandlingTest.php tests/filesystem/UploadTest.php tests/forms/FormTest.php tests/forms/NumericFieldTest.php tests/model/DataListTest.php tests/model/DataObjectTest.php tests/model/TextTest.php tests/security/MemberAuthenticatorTest.php tests/security/SecurityDefaultAdminTest.php tests/view/SSViewerCacheBlockTest.php tests/view/SSViewerTest.php
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* 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>
|
|
* @package framework
|
|
* @subpackage security
|
|
*/
|
|
abstract class LoginForm extends Form {
|
|
public function __construct($controller, $name, $fields, $actions) {
|
|
parent::__construct($controller, $name, $fields, $actions);
|
|
|
|
$this->disableSecurityToken();
|
|
}
|
|
|
|
/**
|
|
* 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 instance
|
|
*
|
|
* @return Authenticator Returns the authenticator instance 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! '{$this->authenticator_class}'"
|
|
. " is not a subclass of 'Authenticator'", E_USER_ERROR);
|
|
return;
|
|
}
|
|
return Injector::inst()->get($this->authenticator_class);
|
|
}
|
|
|
|
/**
|
|
* Get the authenticator name.
|
|
* @return string The friendly name for use in templates, etc.
|
|
*/
|
|
public function getAuthenticatorName() {
|
|
$authClass = $this->authenticator_class;
|
|
return $authClass::get_name();
|
|
}
|
|
|
|
}
|
|
|