mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[feature/passwords] Get rid of unneeded code complexity
Simplified a little bit of code as pointed out by imkingdavid on github. PHPBB3-11610
This commit is contained in:
parent
555cd025b2
commit
808c54fa89
4 changed files with 7 additions and 15 deletions
|
@ -829,7 +829,7 @@ class acp_users
|
||||||
|
|
||||||
// Which updates do we need to do?
|
// Which updates do we need to do?
|
||||||
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
|
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
|
||||||
$update_password = ($data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password'])) ? true : false;
|
$update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']);
|
||||||
$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;
|
$update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false;
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
|
|
|
@ -29,9 +29,8 @@ class bcrypt extends base
|
||||||
*/
|
*/
|
||||||
public function hash($password, $salt = '')
|
public function hash($password, $salt = '')
|
||||||
{
|
{
|
||||||
// The 2x and 2y prefixes of bcrypt might not be supported
|
// Get prefix of this driver
|
||||||
// Revert to 2a if this is the case
|
$prefix = $this->get_prefix();
|
||||||
$prefix = (!$this->is_supported()) ? '$2a$' : $this->get_prefix();
|
|
||||||
|
|
||||||
// Do not support 8-bit characters with $2a$ bcrypt
|
// Do not support 8-bit characters with $2a$ bcrypt
|
||||||
// Also see http://www.php.net/security/crypt_blowfish.php
|
// Also see http://www.php.net/security/crypt_blowfish.php
|
||||||
|
|
|
@ -57,7 +57,7 @@ class salted_md5 extends base
|
||||||
*/
|
*/
|
||||||
public function hash($password, $setting = '')
|
public function hash($password, $setting = '')
|
||||||
{
|
{
|
||||||
if ($setting != '')
|
if ($setting)
|
||||||
{
|
{
|
||||||
if (($settings = $this->get_hash_settings($setting)) === false)
|
if (($settings = $this->get_hash_settings($setting)) === false)
|
||||||
{
|
{
|
||||||
|
@ -95,14 +95,10 @@ class salted_md5 extends base
|
||||||
{
|
{
|
||||||
if (strlen($hash) !== 34)
|
if (strlen($hash) !== 34)
|
||||||
{
|
{
|
||||||
return (md5($password) === $hash) ? true : false;
|
return md5($password) === $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hash === $this->hash($password, $hash))
|
return $hash === $this->hash($password, $hash);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,10 +26,7 @@ class helper
|
||||||
*/
|
*/
|
||||||
public function set_manager(\phpbb\passwords\manager $manager)
|
public function set_manager(\phpbb\passwords\manager $manager)
|
||||||
{
|
{
|
||||||
if ($this->manager === null)
|
$this->manager = $manager;
|
||||||
{
|
|
||||||
$this->manager = $manager;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue