diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-05-29 16:33:35 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-06-01 21:31:05 +0200 |
commit | cf61d35d75bc8b608fb1ee4f5313e797af7ea584 (patch) | |
tree | e5f857cb712ff87fa55fa033123f9a1d0604f3b9 /phpBB | |
parent | 2d7593995ee888da709e21051c4566b3740ef7f2 (diff) | |
download | forums-cf61d35d75bc8b608fb1ee4f5313e797af7ea584.tar forums-cf61d35d75bc8b608fb1ee4f5313e797af7ea584.tar.gz forums-cf61d35d75bc8b608fb1ee4f5313e797af7ea584.tar.bz2 forums-cf61d35d75bc8b608fb1ee4f5313e797af7ea584.tar.xz forums-cf61d35d75bc8b608fb1ee4f5313e797af7ea584.zip |
[ticket/12352] Add driver for woltlab community framework 1 passwords
PHPBB3-12352
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/config/passwords.yml | 8 | ||||
-rw-r--r-- | phpBB/phpbb/passwords/driver/sha1_wcf1.php | 67 |
2 files changed, 75 insertions, 0 deletions
diff --git a/phpBB/config/passwords.yml b/phpBB/config/passwords.yml index 56bbd39917..3dc217286f 100644 --- a/phpBB/config/passwords.yml +++ b/phpBB/config/passwords.yml @@ -62,6 +62,14 @@ services: tags: - { name: passwords.driver } + passwords.driver.sha1_wcf1: + class: phpbb\passwords\driver\sha1_wcf1 + arguments: + - @config + - @passwords.driver_helper + tags: + - { name: passwords.driver } + passwords.driver.sha1: class: phpbb\passwords\driver\sha1 arguments: diff --git a/phpBB/phpbb/passwords/driver/sha1_wcf1.php b/phpBB/phpbb/passwords/driver/sha1_wcf1.php new file mode 100644 index 0000000000..4c1b449c0a --- /dev/null +++ b/phpBB/phpbb/passwords/driver/sha1_wcf1.php @@ -0,0 +1,67 @@ +<?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_wcf1 extends base +{ + const PREFIX = '$wcf1$'; + + /** + * @inheritdoc + */ + public function get_prefix() + { + return self::PREFIX; + } + + /** + * @inheritdoc + */ + public function is_legacy() + { + return true; + } + + /** + * @inheritdoc + */ + public function hash($password, $user_row = '') + { + // Do not support hashing + return false; + } + + /** + * @inheritdoc + */ + public function check($password, $hash, $user_row = array()) + { + if (empty($hash) || !isset($user_row['user_passwd_salt'])) + { + return false; + } + else + { + // Works for standard WCF 1.x, i.e. WBB3 and similar + return $hash === sha1($user_row['user_passwd_salt'] . sha1($user_row['user_passwd_salt'] . sha1($password))); + } + } + + /** + * @inheritdoc + */ + public function get_settings_only($hash, $full = false) + { + return false; + } +} |