diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-12-29 16:33:09 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-12-29 16:33:09 +0100 |
commit | 808c54fa89f556e6f4701d4f8c6c418393ddfc13 (patch) | |
tree | 928d41159e537f59751e9fd5e3a08945c7174cf9 /phpBB/phpbb/passwords | |
parent | [feature/passwords] Remove unnecessary specification of namespace in drivers (diff) | |
download | phpbb-808c54fa89f556e6f4701d4f8c6c418393ddfc13.tar.gz phpbb-808c54fa89f556e6f4701d4f8c6c418393ddfc13.tar.bz2 phpbb-808c54fa89f556e6f4701d4f8c6c418393ddfc13.zip |
[feature/passwords] Get rid of unneeded code complexity
Simplified a little bit of code as pointed out by imkingdavid on github.
PHPBB3-11610
Diffstat (limited to 'phpBB/phpbb/passwords')
-rw-r--r-- | phpBB/phpbb/passwords/driver/bcrypt.php | 5 | ||||
-rw-r--r-- | phpBB/phpbb/passwords/driver/salted_md5.php | 10 | ||||
-rw-r--r-- | phpBB/phpbb/passwords/helper.php | 5 |
3 files changed, 6 insertions, 14 deletions
diff --git a/phpBB/phpbb/passwords/driver/bcrypt.php b/phpBB/phpbb/passwords/driver/bcrypt.php index 1d1b1e267d..b16d2ada56 100644 --- a/phpBB/phpbb/passwords/driver/bcrypt.php +++ b/phpBB/phpbb/passwords/driver/bcrypt.php @@ -29,9 +29,8 @@ class bcrypt extends base */ public function hash($password, $salt = '') { - // The 2x and 2y prefixes of bcrypt might not be supported - // Revert to 2a if this is the case - $prefix = (!$this->is_supported()) ? '$2a$' : $this->get_prefix(); + // Get prefix of this driver + $prefix = $this->get_prefix(); // Do not support 8-bit characters with $2a$ bcrypt // Also see http://www.php.net/security/crypt_blowfish.php diff --git a/phpBB/phpbb/passwords/driver/salted_md5.php b/phpBB/phpbb/passwords/driver/salted_md5.php index 08b0db29a0..72db8d200f 100644 --- a/phpBB/phpbb/passwords/driver/salted_md5.php +++ b/phpBB/phpbb/passwords/driver/salted_md5.php @@ -57,7 +57,7 @@ class salted_md5 extends base */ public function hash($password, $setting = '') { - if ($setting != '') + if ($setting) { if (($settings = $this->get_hash_settings($setting)) === false) { @@ -95,14 +95,10 @@ class salted_md5 extends base { if (strlen($hash) !== 34) { - return (md5($password) === $hash) ? true : false; + return md5($password) === $hash; } - if ($hash === $this->hash($password, $hash)) - { - return true; - } - return false; + return $hash === $this->hash($password, $hash); } /** diff --git a/phpBB/phpbb/passwords/helper.php b/phpBB/phpbb/passwords/helper.php index 20c24c5ee0..59f0bd24ef 100644 --- a/phpBB/phpbb/passwords/helper.php +++ b/phpBB/phpbb/passwords/helper.php @@ -26,10 +26,7 @@ class helper */ public function set_manager(\phpbb\passwords\manager $manager) { - if ($this->manager === null) - { - $this->manager = $manager; - } + $this->manager = $manager; } /** |