Archived
1
0
Fork 0

app/library/Auth.php: in loginOauth() should return false if there is no user.

This commit is contained in:
Henrik Hautakoski 2018-08-13 13:33:17 +02:00
parent bfa71745e0
commit 316edec020
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -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();
}