1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 12:14:06 +02:00

[feature/passwords] Do not pass phpbb_container to passwords manager

PHPBB3-11610
This commit is contained in:
Marc Alexander
2013-09-20 17:31:32 +02:00
parent beafef0000
commit a00854c406
9 changed files with 86 additions and 87 deletions

View File

@@ -25,21 +25,14 @@ class phpbb_passwords_helper
*/
protected $manager;
/**
* @var phpbb_container
*/
protected $container;
/**
* Construct a phpbb_passwords_helper object
*
* @param phpbb_passwords_manager $manager Crypto manager object
* @param phpbb_container $container phpBB container object
*/
public function __construct($manager, $container)
public function __construct($manager)
{
$this->manager = $manager;
$this->container = $container;
}
/**
@@ -85,14 +78,22 @@ class phpbb_passwords_helper
$hash = $hash_settings[0];
// Put settings of current hash into data array
$stored_hash_type = $this->manager->get_hashing_algorithm($password_hash);
$stored_hash_type = $this->manager->detect_algorithm($password_hash);
$this->combine_hash_output($data, 'prefix', $stored_hash_type->get_prefix());
$this->combine_hash_output($data, 'settings', $stored_hash_type->get_settings_only($password_hash));
// Hash current hash with the defined types
foreach ($type as $cur_type)
{
$new_hash_type = $this->container->get($cur_type);
if (isset($this->manager->algorithms[$cur_type]))
{
$new_hash_type = $this->manager->algorithms[$cur_type];
}
else
{
return false;
}
$new_hash = $new_hash_type->hash(str_replace($stored_hash_type->get_settings_only($password_hash), '', $hash));
$this->combine_hash_output($data, 'prefix', $new_hash_type->get_prefix());
$this->combine_hash_output($data, 'settings', substr(str_replace('$', '\\', $new_hash_type->get_settings_only($new_hash, true)), 0));