app/controllers/AuthController.php: in oauthAction() redirect to registration page if no user is found.
This commit is contained in:
parent
7b2f53e4dc
commit
2529d29d80
1 changed files with 13 additions and 9 deletions
|
|
@ -81,17 +81,21 @@ class AuthController extends ControllerBase
|
||||||
else {
|
else {
|
||||||
$result = $this->auth->loginOauth($data);
|
$result = $this->auth->loginOauth($data);
|
||||||
|
|
||||||
// There was an error when creating the account
|
if ($result === false) {
|
||||||
if (is_array($result)) {
|
|
||||||
$msg = '';
|
if (User::findFirstByUsernameOrEmail($data->getEmail())) {
|
||||||
foreach ($result as $message) {
|
$this->flash->error('The email address is already in use.');
|
||||||
$msg .= '<li>' . $message->getMessage() . '</li>';
|
$this->response->redirect('/login');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$this->flash->message('error', "Failed to create account: <ul>{$msg}</ul>");
|
|
||||||
$this->response->redirect('/login');
|
$this->session->set('auth:register:data', $data);
|
||||||
} else {
|
$this->response->redirect(['for' => 'user-register']);
|
||||||
$this->response->redirect('/');
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// User is logged in.
|
||||||
|
$this->response->redirect('/');
|
||||||
}
|
}
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->flash->message('error', 'Failed to authenticate.');
|
$this->flash->message('error', 'Failed to authenticate.');
|
||||||
|
|
|
||||||
Reference in a new issue