protected function _afterIdentifyUser($user, $socialLogin = false, $googleAuthenticatorLogin = false)
{
if (!empty($user)) {
$this->Auth->setUser($user);
if ($googleAuthenticatorLogin) {
$url = Configure::read('GoogleAuthenticator.verifyAction');
return $this->redirect($url);
}
$event = $this->dispatchEvent(UsersAuthComponent::EVENT_AFTER_LOGIN, ['user' => $user]);
if (is_array($event->result)) {
return $this->redirect($event->result);
}
$url = $this->Auth->redirectUrl();
return $this->redirect($url);
} else {
if (!$socialLogin) {
$message = __d('CakeDC/Users', 'Username or password is incorrect');
$this->Flash->error($message, 'default', [], 'auth');
}
return $this->redirect(Configure::read('Auth.loginAction'));
}
}