diff --git a/app/controllers/AuthController.php b/app/controllers/AuthController.php index b3a84ba..08331e7 100644 --- a/app/controllers/AuthController.php +++ b/app/controllers/AuthController.php @@ -54,8 +54,19 @@ class AuthController extends ControllerBase // NOTE: Should pass $state here also. $data = $client->authenticate($code); - $this->auth->loginOauth($data); - $this->response->redirect('/'); + $result = $this->auth->loginOauth($data); + + // There was an error when creating the account + if (is_array($result)) { + $msg = ''; + foreach($result as $message) { + $msg .= '
  • ' . $message->getMessage() . '
  • '; + } + $this->flash->message('error', "Failed to create account: "); + $this->response->redirect('/login'); + } else { + $this->response->redirect('/'); + } } catch(\Exception $e) { $this->flash->message('error', 'Failed to authenticate.'); $this->response->redirect('/login');