Skip to content

Commit 1d2e843

Browse files
committed
make minimum entropy configurable, update banned password const
1 parent 3490664 commit 1d2e843

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

config.php.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@
2323
// won't be locked out after failed login attempts;
2424
const TRUSTED_IPS = [];
2525

26+
// Minimum entropy level for a password to be acceptable.
27+
const MINIMUM_PASSWORD_ENTROPY = 15;
28+
2629
/**
2730
* The list is made up of entries from the following sources, and made all lower case:
2831
* - https://raw.githubusercontent.com/DavidWittman/wpxmlrpcbrute/master/wordlists/1000-most-common-passwords.txt
2932
* - https://nordpass.com/most-common-passwords-list/
3033
* - https://www.safetydetectives.com/blog/the-most-hacked-passwords-in-the-world/
3134
* - https://www.forbes.com/sites/daveywinder/2019/12/14/ranked-the-worlds-100-worst-passwords/
3235
*/
33-
const BANNEDPASSWORDS = [
36+
const BANNED_PASSWORDS = [
3437
'123456',
3538
'password',
3639
'12345678',

lib/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ private static function isExpired($token) {
8181
}
8282

8383
public static function validatePasswordStrength($password) {
84-
$entropy = PasswordValidator::getEntropy($password, BANNEDPASSWORDS);
85-
$minimumEntropy = 50;
84+
$entropy = PasswordValidator::getEntropy($password, BANNED_PASSWORDS);
85+
$minimumEntropy = MINIMUM_PASSWORD_ENTROPY;
8686
if ($entropy < $minimumEntropy) {
8787
return false;
8888
}

0 commit comments

Comments
 (0)