Merge pull request #451 from TonisOrmisson/fixed-ajax-login-events

Fixed issue: remove after/before login events from ajax LoginForm val…
This commit is contained in:
Lorenzo Milesi
2022-04-04 11:12:11 +02:00
committed by GitHub

View File

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