[feature/oauth] Fix errors in oauth

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-08-14 16:45:17 -04:00
parent 9cd80345ad
commit 7bd4c88ec5

View file

@ -425,6 +425,8 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
*/ */
protected function link_account_login_link(array $link_data, $service_name) protected function link_account_login_link(array $link_data, $service_name)
{ {
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $service_name, $this->auth_provider_oauth_token_storage_table);
// Check for an access token, they should have one // Check for an access token, they should have one
if (!$storage->has_access_token_by_session()) if (!$storage->has_access_token_by_session())
{ {
@ -593,10 +595,9 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$this->db->sql_query($sql); $this->db->sql_query($sql);
// Clear all tokens belonging to the user on this servce // Clear all tokens belonging to the user on this servce
$sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_storage_table . " $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
WHERE user_id = " . (int) $this->user->data['user_id'] . " $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $service_name, $this->auth_provider_oauth_token_storage_table);
AND provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "'"; $storage->clearToken();
$this->db->sql_query($sql);
return; return;
} }