app/library/Auth.php: make loginOauth() return validation messages if User::save() fails.
This commit is contained in:
parent
d14741a171
commit
03a0fa3cb7
1 changed files with 8 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Reference in a new issue