fixed issue: user login events not triggered on ajax requests

This commit is contained in:
tonis ormisson
2022-02-16 17:34:08 +02:00
parent a99f05ac08
commit 1179f71b25

View File

@ -125,7 +125,14 @@ class SecurityController extends Controller
if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($form);
$this->trigger(FormEvent::EVENT_BEFORE_LOGIN, $event);
$errors = ActiveForm::validate($form);
if(empty($errors)) {
$this->trigger(FormEvent::EVENT_AFTER_LOGIN, $event);
return $errors;
}
$this->trigger(FormEvent::EVENT_FAILED_LOGIN, $event);
return $errors;
}
if ($form->load(Yii::$app->request->post())) {