diff options
Diffstat (limited to 'app/Auth/Google.php')
-rw-r--r-- | app/Auth/Google.php | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/app/Auth/Google.php b/app/Auth/Google.php index 2bed5b09..9a977037 100644 --- a/app/Auth/Google.php +++ b/app/Auth/Google.php @@ -2,9 +2,7 @@ namespace Auth; -require __DIR__.'/../../vendor/OAuth/bootstrap.php'; - -use Core\Request; +use Event\AuthEvent; use OAuth\Common\Storage\Session; use OAuth\Common\Consumer\Credentials; use OAuth\Common\Http\Uri\UriFactory; @@ -37,19 +35,9 @@ class Google extends Base { $user = $this->user->getByGoogleId($google_id); - if ($user) { - - // Create the user session - $this->user->updateSession($user); - - // Update login history - $this->lastLogin->create( - self::AUTH_NAME, - $user['id'], - Request::getIpAddress(), - Request::getUserAgent() - ); - + if (! empty($user)) { + $this->userSession->refresh($user); + $this->container['dispatcher']->dispatch('auth.success', new AuthEvent(self::AUTH_NAME, $user['id'])); return true; } |