diff --git a/app/library/Auth.php b/app/library/Auth.php index 9f1a841..75c622b 100644 --- a/app/library/Auth.php +++ b/app/library/Auth.php @@ -43,7 +43,8 @@ class Auth extends Component /** * Login using OAuth * - * @param UserDataInterface $auth + * @param UserDataInterface $data + * @return bool|\Phalcon\Mvc\Model\MessageInterface[] */ public function loginOauth(UserDataInterface $data) { @@ -52,13 +53,18 @@ class Auth extends Component if (!$user) { // Did not find any user. create him. $user = User::createFromOAuthData($data); - $user->save(); + + if ($user->save() === false) { + return $user->getMessages(); + } } $this->setIdentity($user->getId()); $this->_eventsManager->fire('auth:onLogin', $this, "OAuth {$data->getProvider()}"); + + return true; } /**