summaryrefslogtreecommitdiff
path: root/app/Auth/GitHub.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Auth/GitHub.php')
-rw-r--r--app/Auth/GitHub.php20
1 files changed, 4 insertions, 16 deletions
diff --git a/app/Auth/GitHub.php b/app/Auth/GitHub.php
index 096d4101..816cc9c1 100644
--- a/app/Auth/GitHub.php
+++ b/app/Auth/GitHub.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;
@@ -36,19 +34,9 @@ class GitHub extends Base
{
$user = $this->user->getByGitHubId($github_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;
}