1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-07 15:05:43 +02:00

[feature/passwords] Properly set convert_flag and add test for it

PHPBB3-11610
This commit is contained in:
Marc Alexander 2013-08-22 19:31:35 -05:00
parent 8b9370c6a9
commit b810957c4b
2 changed files with 8 additions and 1 deletions

View File

@ -196,10 +196,14 @@ class phpbb_crypto_manager
return $this->helper->check_combined_hash($password, $stored_hash_type, $hash);
}
if ($stored_hash_type->get_type() !== $this->type)
if ($stored_hash_type->get_name() !== $this->type)
{
$this->convert_flag = true;
}
else
{
$this->convert_flag = false;
}
return $stored_hash_type->check($password, $hash);
}

View File

@ -126,6 +126,9 @@ class phpbb_crypto_manager_test extends PHPUnit_Framework_TestCase
$password .= $this->pw_characters[mt_rand(0, 66)];
$this->assertEquals(false, $this->manager->check_hash($password, $hash));
}
// Check if convert_flag is correctly set
$this->assertEquals(($hash_type !== 'crypto.driver.bcrypt_2y'), $this->manager->convert_flag);
}