mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-29 02:29:21 +02:00
[ticket/12574] Clean up dependencies of db auth provider
PHPBB3-12574
This commit is contained in:
parent
9e0c3fc81e
commit
a00b8c2920
@ -15,12 +15,12 @@ services:
|
||||
auth.provider.db:
|
||||
class: phpbb\auth\provider\db
|
||||
arguments:
|
||||
- '@dbal.conn'
|
||||
- '@captcha.factory'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@passwords.manager'
|
||||
- '@request'
|
||||
- '@user'
|
||||
- '@service_container'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
tags:
|
||||
|
@ -13,48 +13,69 @@
|
||||
|
||||
namespace phpbb\auth\provider;
|
||||
|
||||
use phpbb\captcha\factory;
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\passwords\manager;
|
||||
use phpbb\request\request_interface;
|
||||
use phpbb\user;
|
||||
|
||||
/**
|
||||
* Database authentication provider for phpBB3
|
||||
* This is for authentication via the integrated user table
|
||||
*/
|
||||
class db extends \phpbb\auth\provider\base
|
||||
class db extends base
|
||||
{
|
||||
/** @var factory CAPTCHA factory */
|
||||
protected $captcha_factory;
|
||||
|
||||
/** @var config phpBB config */
|
||||
protected $config;
|
||||
|
||||
/** @var driver_interface DBAL driver instance */
|
||||
protected $db;
|
||||
|
||||
/** @var request_interface Request object */
|
||||
protected $request;
|
||||
|
||||
/** @var user User object */
|
||||
protected $user;
|
||||
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* phpBB passwords manager
|
||||
*
|
||||
* @var \phpbb\passwords\manager
|
||||
* @var manager
|
||||
*/
|
||||
protected $passwords_manager;
|
||||
|
||||
/**
|
||||
* DI container
|
||||
*
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $phpbb_container;
|
||||
|
||||
/**
|
||||
* Database Authentication Constructor
|
||||
*
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\passwords\manager $passwords_manager
|
||||
* @param \phpbb\request\request $request
|
||||
* @param \phpbb\user $user
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
|
||||
* @param factory $captcha_factory
|
||||
* @param config $config
|
||||
* @param driver_interface $db
|
||||
* @param manager $passwords_manager
|
||||
* @param request_interface $request
|
||||
* @param user $user
|
||||
* @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 $request, \phpbb\user $user, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
|
||||
public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, request_interface $request, user $user, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->captcha_factory = $captcha_factory;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->passwords_manager = $passwords_manager;
|
||||
$this->request = $request;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->phpbb_container = $phpbb_container;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,9 +176,7 @@ class db extends \phpbb\auth\provider\base
|
||||
// Every auth module is able to define what to do by itself...
|
||||
if ($show_captcha)
|
||||
{
|
||||
/* @var $captcha_factory \phpbb\captcha\factory */
|
||||
$captcha_factory = $this->phpbb_container->get('captcha.factory');
|
||||
$captcha = $captcha_factory->get_instance($this->config['captcha_plugin']);
|
||||
$captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']);
|
||||
$captcha->init(CONFIRM_LOGIN);
|
||||
$vc_response = $captcha->validate($row);
|
||||
if ($vc_response)
|
||||
|
@ -52,8 +52,20 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
|
||||
$passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
$plugins = new \phpbb\di\service_collection($phpbb_container);
|
||||
$plugins->add('core.captcha.plugins.nogd');
|
||||
$phpbb_container->set(
|
||||
'captcha.factory',
|
||||
new \phpbb\captcha\factory($phpbb_container, $plugins)
|
||||
);
|
||||
$phpbb_container->set(
|
||||
'core.captcha.plugins.nogd',
|
||||
new \phpbb\captcha\plugins\nogd()
|
||||
);
|
||||
/** @var \phpbb\captcha\factory $captcha_factory */
|
||||
$captcha_factory = $phpbb_container->get('captcha.factory');
|
||||
|
||||
$provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_container, $phpbb_root_path, $phpEx);
|
||||
$provider = new \phpbb\auth\provider\db($captcha_factory, $config, $db, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx);
|
||||
if (version_compare(PHP_VERSION, '5.3.7', '<'))
|
||||
{
|
||||
$password_hash = '$2a$10$e01Syh9PbJjUkio66eFuUu4FhCE2nRgG7QPc1JACalsPXcIuG2bbi';
|
||||
|
Loading…
x
Reference in New Issue
Block a user