app/library/Auth.php: in loginOauth() should return false if there is no user.
This commit is contained in:
parent
bfa71745e0
commit
316edec020
1 changed files with 5 additions and 8 deletions
|
|
@ -44,24 +44,21 @@ class Auth extends Component
|
|||
* Login using OAuth
|
||||
*
|
||||
* @param UserDataInterface $data
|
||||
* @return bool|\Phalcon\Mvc\Model\MessageInterface[]
|
||||
* @return bool
|
||||
*/
|
||||
public function loginOauth(UserDataInterface $data)
|
||||
{
|
||||
$user = User::findFirstByOAuthID($data);
|
||||
|
||||
// Did not find any user.
|
||||
if (!$user) {
|
||||
// Did not find any user. create him.
|
||||
$user = User::createFromOAuthData($data);
|
||||
|
||||
if ($user->save() === false) {
|
||||
return $user->getMessages();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Here we activate the user.
|
||||
// As for OAuth we perform registration if the user does not exist.
|
||||
// We should therefore activate deleted accounts.
|
||||
else if ($user->Status == User::STATUS_DELETED) {
|
||||
if ($user->Status == User::STATUS_DELETED) {
|
||||
$user->Status = User::STATUS_ACTIVE;
|
||||
$user->save();
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue