[Web] Remove redundant password hash checks (#4180)

Co-authored-by: Thomas Ramage <tramage@eucmail.com>
This commit is contained in:
Shea Ramage
2021-07-09 03:54:35 -04:00
committed by GitHub
parent b3959e8071
commit 08dfc0220e
4 changed files with 7 additions and 49 deletions

View File

@@ -979,13 +979,7 @@ function edit_user_account($_data) {
if (password_check($password_new, $password_new2) !== true) {
return false;
}
// support pre hashed passwords
if (preg_match('/^{(ARGON2I|ARGON2ID|BLF-CRYPT|CLEAR|CLEARTEXT|CRYPT|DES-CRYPT|LDAP-MD5|MD5|MD5-CRYPT|PBKDF2|PLAIN|PLAIN-MD4|PLAIN-MD5|PLAIN-TRUNC|PLAIN-TRUNC|SHA|SHA1|SHA256|SHA256-CRYPT|SHA512|SHA512-CRYPT|SMD5|SSHA|SSHA256|SSHA512)}/i', $password)) {
$password_hashed = $password_new;
}
else {
$password_hashed = hash_password($password_new);
}
$password_hashed = hash_password($password_new);
$stmt = $pdo->prepare("UPDATE `mailbox` SET `password` = :password_hashed,
`attributes` = JSON_SET(`attributes`, '$.force_pw_update', '0'),
`attributes` = JSON_SET(`attributes`, '$.passwd_update', NOW())