diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-14 16:32:55 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-14 16:33:10 -0400 |
commit | 9cd80345ad05cccb362ec3eba15304c3f43630ed (patch) | |
tree | 27c05859850104491ff09b46017f483f4e67d497 /phpBB/phpbb/auth | |
parent | a2237ea8a78b6569213e095bb89a6b3f878d129b (diff) | |
download | forums-9cd80345ad05cccb362ec3eba15304c3f43630ed.tar forums-9cd80345ad05cccb362ec3eba15304c3f43630ed.tar.gz forums-9cd80345ad05cccb362ec3eba15304c3f43630ed.tar.bz2 forums-9cd80345ad05cccb362ec3eba15304c3f43630ed.tar.xz forums-9cd80345ad05cccb362ec3eba15304c3f43630ed.zip |
[feature/oauth] Implement unlinking in OAuth
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth')
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/oauth.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index be86180574..9af6f04e38 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -575,4 +575,29 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base 'TEMPLATE_FILE' => 'ucp_auth_link_oauth.html', ); } + + /** + * {@inheritdoc} + */ + public function unlink_account(array $link_data) + { + if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + // Remove the link + $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . " + WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "' + AND user_id = " . (int) $this->user->data['user_id']; + $this->db->sql_query($sql); + + // Clear all tokens belonging to the user on this servce + $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_storage_table . " + WHERE user_id = " . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "'"; + $this->db->sql_query($sql); + + return; + } } |