aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/passwords
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-10-27 14:18:02 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-10-27 14:18:02 +0100
commit5193b3279cfcd4f7f5d656ec806b87e971c5523f (patch)
tree45bb4f9fd78e8a34e2057593aa4b68de9135e86b /phpBB/phpbb/passwords
parent760f148a2ba581df61a25d3efd0e438b5ea77e7b (diff)
downloadforums-5193b3279cfcd4f7f5d656ec806b87e971c5523f.tar
forums-5193b3279cfcd4f7f5d656ec806b87e971c5523f.tar.gz
forums-5193b3279cfcd4f7f5d656ec806b87e971c5523f.tar.bz2
forums-5193b3279cfcd4f7f5d656ec806b87e971c5523f.tar.xz
forums-5193b3279cfcd4f7f5d656ec806b87e971c5523f.zip
[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
Diffstat (limited to 'phpBB/phpbb/passwords')
-rw-r--r--phpBB/phpbb/passwords/manager.php25
1 files changed, 22 insertions, 3 deletions
diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php
index 0c9eb4f067..8abe7b9f79 100644
--- a/phpBB/phpbb/passwords/manager.php
+++ b/phpBB/phpbb/passwords/manager.php
@@ -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;
+ }
+ }
}
/**