mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 09:05:46 +00:00
IMPR: Minor form updates
This commit is contained in:
parent
81d8aecea1
commit
70f42541f2
@ -2,6 +2,7 @@
|
||||
|
||||
namespace A2nt\CMSNiceties\Ajax\Ex;
|
||||
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
|
||||
@ -26,8 +27,13 @@ class AjaxLoginFormControllerEx extends Extension
|
||||
|
||||
/* @var Form $form */
|
||||
$form = $ctrl->LoginForm();
|
||||
|
||||
//$form->addExtraClass('ajax-form');
|
||||
$form->setLegend('Sign in to your service account');
|
||||
//$form->enableSpamProtection();
|
||||
|
||||
if ($form->get_protector()) {
|
||||
$form->enableSpamProtection();
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -43,8 +49,12 @@ class AjaxLoginFormControllerEx extends Extension
|
||||
->getLostPasswordHandler($ctrl->Link())
|
||||
->lostPasswordForm();
|
||||
|
||||
$form->addExtraClass('ajax-form');
|
||||
$form->setLegend('Restore your password');
|
||||
//$form->enableSpamProtection();
|
||||
|
||||
if ($form->get_protector()) {
|
||||
$form->enableSpamProtection();
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -53,6 +63,23 @@ class AjaxLoginFormControllerEx extends Extension
|
||||
{
|
||||
$ctrl = $this->owner;
|
||||
|
||||
if (Director::is_ajax()) {
|
||||
$message = _t(
|
||||
'SilverStripe\\Security\\Security.PASSWORDRESETSENTTEXT',
|
||||
"Thank you. A reset link has been sent, provided an account exists for this email address."
|
||||
);
|
||||
|
||||
$json = json_encode([
|
||||
'status' => 'success',
|
||||
'message' => '<div class="alert alert-success">'.$message.'</div>',
|
||||
]);
|
||||
|
||||
return $json;
|
||||
/*$response = $ctrl->getResponse();
|
||||
$response->setBody($json);
|
||||
die($response->output());*/
|
||||
}
|
||||
|
||||
return Injector::inst()->get(MemberAuthenticator::class)
|
||||
->getLostPasswordHandler($ctrl->Link())
|
||||
->passwordsent();
|
||||
|
Loading…
x
Reference in New Issue
Block a user