mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
IMPR: Login forms
This commit is contained in:
parent
141043d219
commit
10d35e92fc
@ -1,5 +1,8 @@
|
||||
---
|
||||
Name: a2nt-cms-niceties-base-extensions
|
||||
After:
|
||||
- login-forms
|
||||
- '#coresecurity'
|
||||
---
|
||||
# Basic extensions
|
||||
SilverStripe\Admin\LeftAndMain:
|
||||
@ -51,6 +54,10 @@ SilverStripe\Core\Injector\Injector:
|
||||
class: A2nt\CMSNiceties\Forms\GridField\GridFieldConfig_RelationEditor
|
||||
SilverStripe\Forms\FormRequestHandler:
|
||||
class: A2nt\CMSNiceties\Ajax\AjaxFormRequestHandler
|
||||
SilverStripe\Security\Security:
|
||||
properties:
|
||||
Authenticators:
|
||||
default: '%$A2nt\CMSNiceties\Forms\Authenticator'
|
||||
|
||||
SilverStripe\UserForms\Form\UserForm:
|
||||
extensions:
|
||||
|
13
src/Forms/Authentificator.php
Normal file
13
src/Forms/Authentificator.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace A2nt\CMSNiceties\Forms;
|
||||
|
||||
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
|
||||
|
||||
class Authenticator extends MemberAuthenticator
|
||||
{
|
||||
public function getLoginHandler($link)
|
||||
{
|
||||
return LoginHandler::create($link, $this);
|
||||
}
|
||||
}
|
32
src/Forms/LoginHandler.php
Normal file
32
src/Forms/LoginHandler.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace A2nt\CMSNiceties\Forms;
|
||||
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Security\MemberAuthenticator\LoginHandler as MemberAuthenticatorLoginHandler;
|
||||
use SilverStripe\Security\MemberAuthenticator\MemberLoginForm;
|
||||
|
||||
class LoginHandler extends MemberAuthenticatorLoginHandler
|
||||
{
|
||||
private static $allowed_actions = [
|
||||
'LoginForm',
|
||||
];
|
||||
|
||||
public function doLogin($data, MemberLoginForm $form, HTTPRequest $request)
|
||||
{
|
||||
return parent::doLogin($data, $form, $request);
|
||||
}
|
||||
|
||||
public function loginForm()
|
||||
{
|
||||
$form = parent::loginForm();
|
||||
|
||||
if (Director::isLive() && $form->get_protector()) {
|
||||
$form->enableSpamProtection();
|
||||
}
|
||||
$form->addExtraClass('legacy');
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user