aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider/oauth/oauth.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-06-04 17:30:16 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-06-04 17:30:16 +0200
commitf3f82bd3776047ba99d0ba828ce43ff743e65b02 (patch)
treeab1b5270390abaf6b539535871c8f23aacb6c8d0 /phpBB/phpbb/auth/provider/oauth/oauth.php
parent6813735d82d5309327e63d8308988f81554d2299 (diff)
parent9005711ad70148c0ee73f648a96dcc720644e9f9 (diff)
downloadforums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar
forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.gz
forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.bz2
forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.tar.xz
forums-f3f82bd3776047ba99d0ba828ce43ff743e65b02.zip
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth/oauth.php')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index c0ce3f1fba..be0fbf5831 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -553,13 +553,13 @@ class oauth extends \phpbb\auth\provider\base
/**
* {@inheritdoc}
*/
- public function get_auth_link_data()
+ public function get_auth_link_data($user_id = 0)
{
$block_vars = array();
// Get all external accounts tied to the current user
$data = array(
- 'user_id' => (int) $this->user->data['user_id'],
+ 'user_id' => ($user_id <= 0) ? (int) $this->user->data['user_id'] : (int) $user_id,
);
$sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . '
WHERE ' . $this->db->sql_build_array('SELECT', $data);
@@ -616,10 +616,13 @@ class oauth extends \phpbb\auth\provider\base
return 'LOGIN_LINK_MISSING_DATA';
}
+ // Remove user specified in $link_data if possible
+ $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id'];
+
// 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'];
+ AND user_id = " . (int) $user_id;
$this->db->sql_query($sql);
// Clear all tokens belonging to the user on this servce