Skip to content

Commit

Permalink
Password: Check that a user email is part of password in zxcvbn check…
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Apr 14, 2024
1 parent 15659d7 commit 7839820
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- Password: Add ldap_samba_ad driver (#8525)
- Password: Allow LDAP access using LDAP URI and SASL binding (#8402)
- Password: Use Guzzle HTTP Client in 'pwned' driver
- Password: Check that a user email is part of password in zxcvbn checker (#9404)
- Fix attachment name decoding when 'charset' parameter exists in the headers (#9376)
- Fix deprecated (in PHP 8.4) use of session_set_save_handler() (#9060)
- Fix potential HTTP protocol version mismatch (#8982)
Expand Down
8 changes: 7 additions & 1 deletion plugins/password/drivers/zxcvbn.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ public function check_strength($passwd)
], true, true);
}

$rcmail = rcmail::get_instance();
$userData = [
$rcmail->user->get_username('local'),
$_SESSION['username'],
];

$zxcvbn = new Zxcvbn(); // @phpstan-ignore-line
$strength = $zxcvbn->passwordStrength($passwd); // @phpstan-ignore-line
$strength = $zxcvbn->passwordStrength($passwd, $userData); // @phpstan-ignore-line

return [$strength['score'] + 1, $strength['feedback']['warning']];
}
Expand Down

0 comments on commit 7839820

Please sign in to comment.