1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/passwords] Pass list of default types to passwords manager

This list is in the order of how the driver types would be used. If a driver
is not supported we will try the subsequent one.

PHPBB3-11610
This commit is contained in:
Marc Alexander
2013-10-27 14:18:02 +01:00
parent 760f148a2b
commit 5193b3279c
8 changed files with 39 additions and 16 deletions

View File

@@ -63,15 +63,34 @@ class manager
* @param array $hashing_algorithms Hashing driver
* service collection
* @param phpbb\passwords\helper $helper Passwords helper object
* @param string $default Default driver name
* @param string $defaults List of default driver types
*/
public function __construct(\phpbb\config\config $config, $hashing_algorithms, \phpbb\passwords\helper $helper, $default)
public function __construct(\phpbb\config\config $config, $hashing_algorithms, \phpbb\passwords\helper $helper, $defaults)
{
$this->config = $config;
$this->type = $default;
$this->fill_type_map($hashing_algorithms);
$this->load_passwords_helper($helper);
$this->register_default_type($defaults);
}
/**
* Register default type
* Will register the first supported type from the list of default types
*
* @param array $defaults List of default types in order from first to
* use to last to use
*/
protected function register_default_type($defaults)
{
foreach ($defaults as $type)
{
if ($this->algorithms[$type]->is_supported())
{
$this->type = $type;
break;
}
}
}
/**