fix validator bug on recovery controller
This commit is contained in:
@ -88,7 +88,7 @@ class RecoveryController extends Controller
|
||||
|
||||
$event = $this->make(FormEvent::class, [$form]);
|
||||
|
||||
$this->make(AjaxRequestModelValidator::class, $form)->validate();
|
||||
$this->make(AjaxRequestModelValidator::class, [$form])->validate();
|
||||
|
||||
if ($form->load(Yii::$app->request->post())) {
|
||||
$this->trigger(FormEvent::EVENT_BEFORE_REQUEST, $event);
|
||||
@ -165,7 +165,7 @@ class RecoveryController extends Controller
|
||||
'module' => $this->module,
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {var_dump('SHIT!');}
|
||||
}
|
||||
|
||||
return $this->render('reset', ['model' => $form]);
|
||||
|
||||
@ -30,12 +30,11 @@ class AjaxRequestModelValidator implements ValidatorInterface
|
||||
{
|
||||
$request = Yii::$app->request;
|
||||
|
||||
if ($request->getIsAjax() && !$request->getIsPjax()) {
|
||||
if ($this->model->load($request->post())) {
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
echo json_encode(ActiveForm::validate($this->model));
|
||||
Yii::$app->end();
|
||||
}
|
||||
if ($request->getIsAjax() && $this->model->load($request->post())) {
|
||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
Yii::$app->response->data = ActiveForm::validate($this->model);
|
||||
Yii::$app->response->send();
|
||||
Yii::$app->end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user