public function failedSocialLogin($exception, $data, $flash = false)
{
$msg = __d('CakeDC/Users', 'Issues trying to log in with your social account');
if (isset($exception)) {
if ($exception instanceof MissingEmailException) {
if ($flash) {
$this->Flash->success(__d('CakeDC/Users', 'Please enter your email'));
}
$this->request->session()->write(Configure::read('Users.Key.Session.social'), $data);
return $this->redirect(['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'socialEmail']);
}
if ($exception instanceof UserNotActiveException) {
$msg = __d('CakeDC/Users', 'Your user has not been validated yet. Please check your inbox for instructions');
} elseif ($exception instanceof AccountNotActiveException) {
$msg = __d('CakeDC/Users', 'Your social account has not been validated yet. Please check your inbox for instructions');
}
}
if ($flash) {
$this->Auth->config('authError', $msg);
$this->Auth->config('flash.params', ['class' => 'success']);
$this->request->session()->delete(Configure::read('Users.Key.Session.social'));
$this->Flash->success(__d('CakeDC/Users', $msg));
}
return $this->redirect(['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'login']);
}