mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 16:05:00 +02:00
[feature/passwords] Properly set convert_flag and add test for it
PHPBB3-11610
This commit is contained in:
parent
8b9370c6a9
commit
b810957c4b
@ -196,10 +196,14 @@ class phpbb_crypto_manager
|
|||||||
return $this->helper->check_combined_hash($password, $stored_hash_type, $hash);
|
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;
|
$this->convert_flag = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->convert_flag = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $stored_hash_type->check($password, $hash);
|
return $stored_hash_type->check($password, $hash);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,9 @@ class phpbb_crypto_manager_test extends PHPUnit_Framework_TestCase
|
|||||||
$password .= $this->pw_characters[mt_rand(0, 66)];
|
$password .= $this->pw_characters[mt_rand(0, 66)];
|
||||||
$this->assertEquals(false, $this->manager->check_hash($password, $hash));
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user