[feature/oauth] Fix redirects

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-08-24 21:34:23 -04:00
parent 76d1e7e111
commit 310caec5d9
3 changed files with 25 additions and 8 deletions

View file

@ -46,6 +46,8 @@ services:
- %tables.auth_provider_oauth_account_assoc%
- @auth.provider.oauth.service_collection
- %tables.users%
- %core.root_path%
- %core.php_ext%
tags:
- { name: auth.provider }
auth.provider.oauth.service_collection:

View file

@ -975,12 +975,9 @@ class phpbb_auth
{
// If this status exists a fourth field is in the $login array called 'redirect_data'
// This data is passed along as GET data to the next page allow the account to be linked
$url = 'ucp.php?mode=login_link';
foreach ($login['redirect_data'] as $key => $value)
{
$url .= '&' . $key . '=' . $value;
}
$params = array('mode' => 'login_link');
$url = append_sid('ucp.' . $phpEx, array_merge($params, $login['redirect_data']));
redirect($url);
}

View file

@ -88,6 +88,20 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
*/
protected $current_uri;
/**
* phpBB root path
*
* @var string
*/
protected $phpbb_root_path;
/**
* PHP extenstion
*
* @var string
*/
protected $php_ext;
/**
* OAuth Authentication Constructor
*
@ -98,9 +112,11 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
* @param string $auth_provider_oauth_token_storage_table
* @param string $auth_provider_oauth_token_account_assoc
* @param phpbb_di_service_collection $service_providers Contains phpbb_auth_provider_oauth_service_interface
* @param string $users)table
* @param string $users_table
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, phpbb_di_service_collection $service_providers, $users_table)
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, phpbb_di_service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
@ -110,6 +126,8 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc;
$this->service_providers = $service_providers;
$this->users_table = $users_table;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
/**
@ -138,7 +156,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
// Temporary workaround for only having one authentication provider available
if (!$this->request->is_set('oauth_service'))
{
$provider = new phpbb_auth_provider_db($this->db, $this->config, $this->request, $this->user, $phpbb_root_path, $phpEx);
$provider = new phpbb_auth_provider_db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext);
return $provider->login($username, $password);
}