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
c351cb73f8
commit
81d8aecea1
@ -15,6 +15,7 @@ SilverStripe\SiteConfig\SiteConfig:
|
||||
PageController:
|
||||
extensions:
|
||||
- A2nt\CMSNiceties\Extensions\PageControllerEx
|
||||
- A2nt\CMSNiceties\Ajax\Ex\AjaxLoginFormControllerEx
|
||||
|
||||
SilverStripe\CMS\Model\SiteTree:
|
||||
default_container_class: 'container'
|
||||
|
60
src/Ajax/Ex/AjaxLoginFormControllerEx.php
Executable file
60
src/Ajax/Ex/AjaxLoginFormControllerEx.php
Executable file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace A2nt\CMSNiceties\Ajax\Ex;
|
||||
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
|
||||
use SilverStripe\Security\Security;
|
||||
|
||||
/**
|
||||
* Class \App\Service\Ex\ServiceAreaController
|
||||
*
|
||||
* @property \A2nt\CMSNiceties\Ajax\Ex\AjaxLoginFormControllerEx $owner
|
||||
*/
|
||||
class AjaxLoginFormControllerEx extends Extension
|
||||
{
|
||||
private static $allowed_actions = [
|
||||
'LoginFormEx',
|
||||
'LostPasswordForm',
|
||||
'passwordsent',
|
||||
];
|
||||
|
||||
public function LoginFormEx()
|
||||
{
|
||||
$ctrl = $this->owner;
|
||||
|
||||
/* @var Form $form */
|
||||
$form = $ctrl->LoginForm();
|
||||
$form->setLegend('Sign in to your service account');
|
||||
//$form->enableSpamProtection();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function LostPasswordForm()
|
||||
{
|
||||
if (Security::getCurrentUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ctrl = $this->owner;
|
||||
$form = Injector::inst()->get(MemberAuthenticator::class)
|
||||
->getLostPasswordHandler($ctrl->Link())
|
||||
->lostPasswordForm();
|
||||
|
||||
$form->setLegend('Restore your password');
|
||||
//$form->enableSpamProtection();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function passwordsent()
|
||||
{
|
||||
$ctrl = $this->owner;
|
||||
|
||||
return Injector::inst()->get(MemberAuthenticator::class)
|
||||
->getLostPasswordHandler($ctrl->Link())
|
||||
->passwordsent();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user