mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/12352] Add passwords driver for passwords that should be converted
This driver will only be used for getting the new $CP$ prefix that will signal that the hash is a legacy hash that needs to be converted. PHPBB3-12352
This commit is contained in:
parent
57e4fb3810
commit
1e758ba7f0
3 changed files with 63 additions and 1 deletions
|
@ -38,6 +38,14 @@ services:
|
|||
tags:
|
||||
- { name: passwords.driver }
|
||||
|
||||
passwords.driver.convert_password:
|
||||
class: phpbb\passwords\driver\convert_password
|
||||
arguments:
|
||||
- @config
|
||||
- @passwords.driver_helper
|
||||
tags:
|
||||
- { name: passwords.driver }
|
||||
|
||||
passwords.driver.sha1_smf:
|
||||
class: phpbb\passwords\driver\sha1_smf
|
||||
arguments:
|
||||
|
|
50
phpBB/phpbb/passwords/driver/convert_password.php
Normal file
50
phpBB/phpbb/passwords/driver/convert_password.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2014 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\passwords\driver;
|
||||
|
||||
/**
|
||||
* @package passwords
|
||||
*/
|
||||
class convert_password extends base
|
||||
{
|
||||
const PREFIX = '$CP$';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_prefix()
|
||||
{
|
||||
return self::PREFIX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function hash($password, $user_row = '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function check($password, $hash, $user_row = array())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_settings_only($hash, $full = false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -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.convert_password' => new \phpbb\passwords\driver\convert_password($config, $this->driver_helper),
|
||||
'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper),
|
||||
);
|
||||
|
||||
|
@ -134,13 +135,16 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
|
|||
{
|
||||
return array(
|
||||
array('foobar', '3858f62230ac3c915f300c664312c63f', true),
|
||||
array('foobar', '$CP$3858f62230ac3c915f300c664312c63f', true),
|
||||
array('foobar', '$CP$3858f62230ac3c915f300c', false),
|
||||
array('foobar', '$S$b57a939fa4f2c04413a4eea9734a0903647b7adb93181295', false),
|
||||
array('foobar', '$2a\S$kkkkaakdkdiej39023903204j2k3490234jk234j02349', false),
|
||||
array('foobar', '$H$kklk938d023k//k3023', false),
|
||||
array('foobar', '$H$3PtYMgXb39lrIWkgoxYLWtRkZtY3AY/', false),
|
||||
array('foobar', '$2a$kwiweorurlaeirw', false),
|
||||
array('foobar', '6f9e2a1899e1f15708fd2e554103480eb53e8b57', false),
|
||||
array('foobar', '6f9e2a1899e1f15708fd2e554103480eb53e8b57', true, array('login_name' => 'test')),
|
||||
array('foobar', '6f9e2a1899e1f15708fd2e554103480eb53e8b57', false, array('login_name' => 'test')),
|
||||
array('foobar', '$CP$6f9e2a1899e1f15708fd2e554103480eb53e8b57', true, array('login_name' => 'test')),
|
||||
array('foobar', '6f9e2a1899', false, array('login_name' => 'test')),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue