aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/ucp/ucp_auth_link.php13
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php15
-rw-r--r--phpBB/styles/prosilver/template/ucp_auth_link_oauth.html4
3 files changed, 26 insertions, 6 deletions
diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php
index 5b8169e3de..6c56f8ac3c 100644
--- a/phpBB/includes/ucp/ucp_auth_link.php
+++ b/phpBB/includes/ucp/ucp_auth_link.php
@@ -48,7 +48,20 @@ class ucp_auth_link
if (!sizeof($error))
{
+ // Any post data could be necessary for auth (un)linking
+ $link_data = $request->get_super_global(phpbb_request_interface::POST);
+ // The current user_id is also necessary
+ $link_data['user_id'] = $user->data['user_id'];
+
+ if ($request->variable('link', false, false, phpbb_request_interface::POST))
+ {
+ $error[] = $auth_provider->link_account($link_data);
+ }
+ else
+ {
+ $error[] = $auth_provider->unlink_account($link_data);
+ }
}
}
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index cfffdf2c96..d2f7eb5527 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -405,10 +405,18 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
return 'LOGIN_LINK_ERROR_OAUTH_NO_ACCESS_TOKEN';
}
+ // Prepare the query string
+ if ($this->request->variable('mode', 'login_link'))
+ {
+ $query = 'mode=login_link';
+ } else {
+ $query = 'i=ucp_auth_link&mode=auth_link';
+ }
+ $query .= '&login_link_oauth_service=' . strtolower($link_data['oauth_service']);
+
// Prepare for an authentication request
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
$scopes = $this->service_providers[$service_name]->get_auth_scope();
- $query = 'mode=login_link&login_link_oauth_service=' . strtolower($link_data['oauth_service']);
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
$this->service_providers[$service_name]->set_external_service_provider($service);
@@ -462,7 +470,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$oauth_user_ids = array();
- if ($rows !== false && !empty($rows))
+ if ($rows !== false && sizeof($rows))
{
foreach ($rows as $row)
{
@@ -478,14 +486,13 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
if ($credentials['key'] && $credentials['secret'])
{
$actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
- $redirect_url = build_url(false) . '&login=external&oauth_service=' . $actual_name;
$block_vars[$service_name] = array(
'HIDDEN_FIELDS' => array(
+ 'link' => (!isset($oauth_user_ids[$actual_name])),
'oauth_service' => $actual_name,
),
- 'REDIRECT_URL' => redirect($redirect_url, true),
'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
'UNIQUE_ID' => (isset($oauth_user_ids[$actual_name])) ? $oauth_user_ids[$actual_name] : null,
);
diff --git a/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html b/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html
index 886aca2aa6..a50c786b48 100644
--- a/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html
+++ b/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html
@@ -10,7 +10,7 @@
</dl>
<dl>
<dt>&nbsp;</dt>
- <dd><input type="submit" name="unlink" tabindex="6" value="{L_UNLINK}" class="button1" /></dd>
+ <dd><input type="submit" name="submit" tabindex="6" value="{L_UNLINK}" class="button1" /></dd>
</dl>
<!-- ELSE -->
<dl>
@@ -18,7 +18,7 @@
</dl>
<dl>
<dt>&nbsp;</dt>
- <dd><input type="submit" name="link" tabindex="6" value="{L_LINK}" class="button1" /></dd>
+ <dd><input type="submit" name="submit" tabindex="6" value="{L_LINK}" class="button1" /></dd>
</dl>
<!-- ENDIF-->
</fieldset>