cms-niceties/src/Forms/LoginHandler.php

33 lines
854 B
PHP
Raw Permalink Normal View History

2024-03-26 03:22:27 +01:00
<?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();
2024-03-26 03:58:54 +01:00
if (self::config()->get('enable_captcha') && Director::isLive() && $form->get_protector()) {
2024-03-26 03:22:27 +01:00
$form->enableSpamProtection();
}
$form->addExtraClass('legacy');
return $form;
}
}