Line 96 | Line 96 |
---|
* @var \Symfony\Component\DependencyInjection\ContainerInterface */ protected $phpbb_container;
|
* @var \Symfony\Component\DependencyInjection\ContainerInterface */ protected $phpbb_container;
|
| /** * phpBB event dispatcher * * @var \phpbb\event\dispatcher_interface */ protected $dispatcher;
|
/** * phpBB root path
| /** * phpBB root path
|
Line 124 | Line 131 |
---|
* @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
|
* @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
|
| * @param \phpbb\event\dispatcher_interface $dispatcher phpBB event dispatcher
|
* @param string $phpbb_root_path * @param string $php_ext */
|
* @param string $phpbb_root_path * @param string $php_ext */
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
| public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, \phpbb\event\dispatcher_interface $dispatcher, $phpbb_root_path, $php_ext)
|
{ $this->db = $db; $this->config = $config;
| { $this->db = $db; $this->config = $config;
|
Line 139 | Line 147 |
---|
$this->service_providers = $service_providers; $this->users_table = $users_table; $this->phpbb_container = $phpbb_container;
|
$this->service_providers = $service_providers; $this->users_table = $users_table; $this->phpbb_container = $phpbb_container;
|
| $this->dispatcher = $dispatcher;
|
$this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; }
| $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; }
|
Line 237 | Line 246 |
---|
// Update token storage to store the user_id $storage->set_user_id($row['user_id']);
|
// Update token storage to store the user_id $storage->set_user_id($row['user_id']);
|
| /** * Event is triggered after user is successfuly logged in via OAuth. * * @event core.auth_oauth_login_after * @var array row User row * @since 3.1.11-RC1 */ $vars = array( 'row', ); extract($this->dispatcher->trigger_event('core.auth_oauth_login_after', compact($vars)));
|
// The user is now authenticated and can be logged in return array(
| // The user is now authenticated and can be logged in return array(
|
Line 271 | Line 292 |
---|
}
$uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
|
}
$uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
|
$current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER));
| $super_globals = $this->request->get_super_global(\phpbb\request\request_interface::SERVER); if (!empty($super_globals['HTTP_X_FORWARDED_PROTO']) && $super_globals['HTTP_X_FORWARDED_PROTO'] === 'https') { $super_globals['HTTPS'] = 'on'; $super_globals['SERVER_PORT'] = 443; } $current_uri = $uri_factory->createFromSuperGlobalArray($super_globals);
|
$current_uri->setQuery($query);
$this->current_uri = $current_uri;
| $current_uri->setQuery($query);
$this->current_uri = $current_uri;
|
Line 536 | Line 563 |
---|
$sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . ' ' . $this->db->sql_build_array('INSERT', $data); $this->db->sql_query($sql);
|
$sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . ' ' . $this->db->sql_build_array('INSERT', $data); $this->db->sql_query($sql);
|
| /** * Event is triggered after user links account. * * @event core.auth_oauth_link_after * @var array data User row * @since 3.1.11-RC1 */ $vars = array( 'data', ); extract($this->dispatcher->trigger_event('core.auth_oauth_link_after', compact($vars)));
|
}
/**
| }
/**
|
Line 553 | Line 592 |
---|
/** * {@inheritdoc} */
|
/** * {@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(
|
{ $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);
| ); $sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . ' WHERE ' . $this->db->sql_build_array('SELECT', $data);
|
Line 615 | Line 654 |
---|
{ return 'LOGIN_LINK_MISSING_DATA'; }
|
{ 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']) . "'
|
// 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
| $this->db->sql_query($sql);
// Clear all tokens belonging to the user on this servce
|