IMPR: AJAX processing
This commit is contained in:
parent
a81011feb2
commit
cd78ad1f9e
|
@ -7,6 +7,7 @@ use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
|
use SilverStripe\Security\MemberAuthenticator\MemberAuthenticator;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\View\SSViewer;
|
use SilverStripe\View\SSViewer;
|
||||||
|
@ -24,12 +25,23 @@ class AjaxControllerEx extends Extension
|
||||||
'passwordsent',
|
'passwordsent',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private static function _makeAllFieldsRequired(Form $form)
|
||||||
|
{
|
||||||
|
$fields = $form->Fields();
|
||||||
|
foreach ($fields as $f) {
|
||||||
|
$f
|
||||||
|
->setAttribute('required', 'required')
|
||||||
|
->addExtraClass('required');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function LoginFormEx()
|
public function LoginFormEx()
|
||||||
{
|
{
|
||||||
$ctrl = $this->owner;
|
$ctrl = $this->owner;
|
||||||
|
|
||||||
/* @var Form $form */
|
/* @var Form $form */
|
||||||
$form = $ctrl->LoginForm();
|
$form = $ctrl->LoginForm();
|
||||||
|
self::_makeAllFieldsRequired($form);
|
||||||
|
|
||||||
//$form->addExtraClass('ajax-form');
|
//$form->addExtraClass('ajax-form');
|
||||||
$form->setLegend('Sign in to your service account');
|
$form->setLegend('Sign in to your service account');
|
||||||
|
@ -52,6 +64,7 @@ class AjaxControllerEx extends Extension
|
||||||
->getLostPasswordHandler($ctrl->Link())
|
->getLostPasswordHandler($ctrl->Link())
|
||||||
->lostPasswordForm();
|
->lostPasswordForm();
|
||||||
|
|
||||||
|
self::_makeAllFieldsRequired($form);
|
||||||
$form->addExtraClass('ajax-form');
|
$form->addExtraClass('ajax-form');
|
||||||
$form->setLegend('Restore your password');
|
$form->setLegend('Restore your password');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue