summaryrefslogtreecommitdiff
path: root/app/Model/Google.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Google.php')
-rw-r--r--app/Model/Google.php20
1 files changed, 7 insertions, 13 deletions
diff --git a/app/Model/Google.php b/app/Model/Google.php
index f5beb8f8..cca4f668 100644
--- a/app/Model/Google.php
+++ b/app/Model/Google.php
@@ -27,21 +27,19 @@ class Google extends Base
*/
public function authenticate($google_id)
{
- $userModel = new User($this->db, $this->event);
- $user = $userModel->getByGoogleId($google_id);
+ $user = $this->user->getByGoogleId($google_id);
if ($user) {
// Create the user session
- $userModel->updateSession($user);
+ $this->user->updateSession($user);
// Update login history
- $lastLogin = new LastLogin($this->db, $this->event);
- $lastLogin->create(
+ $this->lastLogin->create(
LastLogin::AUTH_GOOGLE,
$user['id'],
- $userModel->getIpAddress(),
- $userModel->getUserAgent()
+ $this->user->getIpAddress(),
+ $this->user->getUserAgent()
);
return true;
@@ -59,9 +57,7 @@ class Google extends Base
*/
public function unlink($user_id)
{
- $userModel = new User($this->db, $this->event);
-
- return $userModel->update(array(
+ return $this->user->update(array(
'id' => $user_id,
'google_id' => '',
));
@@ -77,9 +73,7 @@ class Google extends Base
*/
public function updateUser($user_id, array $profile)
{
- $userModel = new User($this->db, $this->event);
-
- return $userModel->update(array(
+ return $this->user->update(array(
'id' => $user_id,
'google_id' => $profile['id'],
'email' => $profile['email'],