Refactoring of Github authentication (oauth url change)

This commit is contained in:
Frederic Guillot
2015-07-16 20:35:56 -04:00
parent 12036aa21f
commit ede1f1d9b0
33 changed files with 426 additions and 485 deletions

View File

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