[feature/passwords] Add legacy support for md5 passwords

PHPBB3-11610
This commit is contained in:
Marc Alexander 2013-07-19 20:14:25 +02:00
parent bd4664807f
commit 2e453eb2cb
3 changed files with 4 additions and 4 deletions

View file

@ -82,9 +82,9 @@ class phpbb_crypto_driver_salted_md5 extends phpbb_crypto_driver_base
*/
public function check($password, $hash)
{
if (strlen($hash) != 34)
if (strlen($hash) !== 34)
{
return false;
return (md5($password) === $hash) ? true : false;
}
// No need to check prefix, already did that in manage

View file

@ -112,7 +112,7 @@ class phpbb_crypto_manager
*/
if (!preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match))
{
return false;
return $this->type_map['$H$'];
}
// Be on the lookout for multiple hashing algorithms

View file

@ -131,7 +131,7 @@ class phpbb_crypto_manager_test extends PHPUnit_Framework_TestCase
public function check_hash_exceptions_data()
{
return array(
array('foobar', '3858F62230AC3C915F300C664312C63F', false),
array('foobar', '3858f62230ac3c915f300c664312c63f', true),
array('foobar', '$S$b57a939fa4f2c04413a4eea9734a0903647b7adb93181295', false),
array('foobar', '$2a\S$kkkkaakdkdiej39023903204j2k3490234jk234j02349', false),
array('foobar', '$H$kklk938d023k//k3023', false),