summaryrefslogtreecommitdiff
path: root/app/Auth/Google.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-16 20:35:56 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-16 20:35:56 -0400
commitede1f1d9b0c06a05845f4125d59c97c29b6d9842 (patch)
tree2fc9f21c586501d43440dace17e71bfb40618bfc /app/Auth/Google.php
parent12036aa21f4308aca4d816864b357f9627a0f437 (diff)
Refactoring of Github authentication (oauth url change)
Diffstat (limited to 'app/Auth/Google.php')
-rw-r--r--app/Auth/Google.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/Auth/Google.php b/app/Auth/Google.php
index dd8f3834..972dd748 100644
--- a/app/Auth/Google.php
+++ b/app/Auth/Google.php
@@ -22,6 +22,7 @@ class Google extends Base
/**
* OAuth2 instance
*
+ * @access private
* @var \Core\OAuth2
*/
private $service;
@@ -71,11 +72,13 @@ class Google extends Base
*/
public function updateUser($user_id, array $profile)
{
+ $user = $this->user->getById($user_id);
+
return $this->user->update(array(
'id' => $user_id,
'google_id' => $profile['id'],
- 'email' => $profile['email'],
- 'name' => $profile['name'],
+ 'email' => $profile['email'] ?: $user['email'],
+ 'name' => $profile['name'] ?: $user['name'],
));
}
@@ -114,7 +117,7 @@ class Google extends Base
return $this->httpClient->getJson(
'https://www.googleapis.com/oauth2/v1/userinfo',
- array($this->getService()->getAuthorizationHeader()
- ));
+ array($this->getService()->getAuthorizationHeader())
+ );
}
}