silverstripe-framework/src/Security/LoginForm.php

60 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2016-06-23 01:37:22 +02:00
namespace SilverStripe\Security;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
2016-06-23 01:37:22 +02:00
/**
* 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>
*/
2016-11-29 00:31:16 +01:00
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;
2017-10-05 17:40:31 +02:00
public function setAuthenticatorClass($class)
{
$this->authenticator_class = $class;
$authenticatorField = $this->Fields()->dataFieldByName('AuthenticationMethod');
if ($authenticatorField) {
$authenticatorField->setValue($class);
}
return $this;
}
2016-11-29 00:31:16 +01:00
/**
* Return the title of the form for use in the frontend
* For tabs with multiple login methods, for example.
* This replaces the old `get_name` method
* @return string
2016-11-29 00:31:16 +01:00
*/
abstract public function getAuthenticatorName();
/**
* Required FieldList creation on a LoginForm
*
* @return FieldList
*/
abstract protected function getFormFields();
/**
* Required FieldList creation for the login actions on this LoginForm
*
* @return FieldList
*/
abstract protected function getFormActions();
}