mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/12352] Add legacy passwords driver for sha1 smf type passwords
PHPBB3-12352
This commit is contained in:
@@ -24,6 +24,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
|
||||
'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper),
|
||||
'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper),
|
||||
'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper),
|
||||
'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,4 +83,36 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
|
||||
);
|
||||
$this->assertEquals(false, $this->passwords_drivers['passwords.driver.salted_md5']->get_hash_settings(false));
|
||||
}
|
||||
|
||||
public function data_hash_sha1_smf()
|
||||
{
|
||||
return array(
|
||||
array(false, 'test', array()),
|
||||
array(false, 'test', ''),
|
||||
array('6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'foobar', array('login_name' => 'test')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_hash_sha1_smf
|
||||
*/
|
||||
public function test_hash_sha1_smf($expected, $password, $user_row)
|
||||
{
|
||||
$this->assertSame($expected, $this->passwords_drivers['passwords.driver.sha1_smf']->hash($password, $user_row));
|
||||
}
|
||||
|
||||
public function data_get_settings()
|
||||
{
|
||||
return array(
|
||||
array(false, '6f9e2a1899e1f15708fd2e554103480eb53e8b57', 'passwords.driver.sha1_smf'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_get_settings
|
||||
*/
|
||||
public function test_get_settings_only($expected, $hash, $driver)
|
||||
{
|
||||
$this->assertSame($expected, $this->passwords_drivers[$driver]->get_settings_only($hash));
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
|
||||
'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper),
|
||||
'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper),
|
||||
'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper),
|
||||
'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper),
|
||||
);
|
||||
|
||||
$this->helper = new \phpbb\passwords\helper;
|
||||
|
Reference in New Issue
Block a user