app/controllers/AuthController.php: in oauthAction() show flash message if account creation failed.
This commit is contained in:
parent
03a0fa3cb7
commit
22627a811c
1 changed files with 13 additions and 2 deletions
|
|
@ -54,8 +54,19 @@ class AuthController extends ControllerBase
|
||||||
// NOTE: Should pass $state here also.
|
// NOTE: Should pass $state here also.
|
||||||
$data = $client->authenticate($code);
|
$data = $client->authenticate($code);
|
||||||
|
|
||||||
$this->auth->loginOauth($data);
|
$result = $this->auth->loginOauth($data);
|
||||||
$this->response->redirect('/');
|
|
||||||
|
// There was an error when creating the account
|
||||||
|
if (is_array($result)) {
|
||||||
|
$msg = '';
|
||||||
|
foreach($result as $message) {
|
||||||
|
$msg .= '<li>' . $message->getMessage() . '</li>';
|
||||||
|
}
|
||||||
|
$this->flash->message('error', "Failed to create account: <ul>{$msg}</ul>");
|
||||||
|
$this->response->redirect('/login');
|
||||||
|
} else {
|
||||||
|
$this->response->redirect('/');
|
||||||
|
}
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->flash->message('error', 'Failed to authenticate.');
|
$this->flash->message('error', 'Failed to authenticate.');
|
||||||
$this->response->redirect('/login');
|
$this->response->redirect('/login');
|
||||||
|
|
|
||||||
Reference in a new issue