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
|
* Login using OAuth
|
||||||
*
|
*
|
||||||
* @param UserDataInterface $data
|
* @param UserDataInterface $data
|
||||||
* @return bool|\Phalcon\Mvc\Model\MessageInterface[]
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function loginOauth(UserDataInterface $data)
|
public function loginOauth(UserDataInterface $data)
|
||||||
{
|
{
|
||||||
$user = User::findFirstByOAuthID($data);
|
$user = User::findFirstByOAuthID($data);
|
||||||
|
|
||||||
|
// Did not find any user.
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
// Did not find any user. create him.
|
return false;
|
||||||
$user = User::createFromOAuthData($data);
|
|
||||||
|
|
||||||
if ($user->save() === false) {
|
|
||||||
return $user->getMessages();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here we activate the user.
|
// Here we activate the user.
|
||||||
// As for OAuth we perform registration if the user does not exist.
|
// As for OAuth we perform registration if the user does not exist.
|
||||||
// We should therefore activate deleted accounts.
|
// 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->Status = User::STATUS_ACTIVE;
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue