diff options
Diffstat (limited to 'phpBB/phpbb/passwords/driver')
| -rw-r--r-- | phpBB/phpbb/passwords/driver/base.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/passwords/driver/driver_interface.php | 7 | ||||
| -rw-r--r-- | phpBB/phpbb/passwords/driver/sha1_smf.php | 58 | 
3 files changed, 73 insertions, 0 deletions
diff --git a/phpBB/phpbb/passwords/driver/base.php b/phpBB/phpbb/passwords/driver/base.php index fffc9d1461..b74c2d3d72 100644 --- a/phpBB/phpbb/passwords/driver/base.php +++ b/phpBB/phpbb/passwords/driver/base.php @@ -43,4 +43,12 @@ abstract class base implements driver_interface  	{  		return true;  	} + +	/** +	* @inheritdoc +	*/ +	public function is_legacy() +	{ +		return false; +	}  } diff --git a/phpBB/phpbb/passwords/driver/driver_interface.php b/phpBB/phpbb/passwords/driver/driver_interface.php index 54c9d6500e..d38681b75f 100644 --- a/phpBB/phpbb/passwords/driver/driver_interface.php +++ b/phpBB/phpbb/passwords/driver/driver_interface.php @@ -23,6 +23,13 @@ interface driver_interface  	public function is_supported();  	/** +	* Check if hash type is a legacy hash type +	* +	* @return bool		True if it's a legacy hash type, false if not +	*/ +	public function is_legacy(); + +	/**  	* Returns the hash prefix  	*  	* @return string	Hash prefix diff --git a/phpBB/phpbb/passwords/driver/sha1_smf.php b/phpBB/phpbb/passwords/driver/sha1_smf.php new file mode 100644 index 0000000000..f7f5587485 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha1_smf.php @@ -0,0 +1,58 @@ +<?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 sha1_smf extends base +{ +	const PREFIX = '$smf$'; + +	/** +	* @inheritdoc +	*/ +	public function get_prefix() +	{ +		return self::PREFIX; +	} + +	/** +	* @inheritdoc +	*/ +	public function is_legacy() +	{ +		return true; +	} + +	/** +	* @inheritdoc +	*/ +	public function hash($password, $user_row = '') +	{ +		return (isset($user_row['login_name'])) ? sha1(strtolower($user_row['login_name']) . $password) : false; +	} + +	/** +	* @inheritdoc +	*/ +	public function check($password, $hash, $user_row = array()) +	{ +		return $hash === $this->hash($password, $user_row); +	} + +	/** +	* @inheritdoc +	*/ +	public function get_settings_only($hash, $full = false) +	{ +		return false; +	} +}  | 
