diff --git a/README.md b/README.md index fc9837e..e034a25 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,12 @@ Create a `config/enforce-password.php` with the following contents: return [ 'passwordMinLength' => 16, 'passwordMaxLength' => 255, - 'passwordHistoryLimit' => 5, // Number of passwords kept in history + 'passwordHistoryLimit' => 5, // Number of passwords kept in history, set to 0 to disable this feature 'passwordMaxLifetime' => 90, // Number of days a password can be used 'enforceUppercase' => true, // Min 1 uppercase letter 'enforceLowercase' => true, // Min 1 lowercase letter 'enforceDigit' => true, // Min 1 digit 'enforceSymbol' => true, // Min 1 symbol - 'enforceUniquePassword' => true; // An password never used before by the user ]; ``` diff --git a/src/models/Settings.php b/src/models/Settings.php index b5f8834..6f0bfea 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -8,11 +8,10 @@ class Settings extends Model { public $passwordMinLength = 16; public $passwordMaxLength = 255; - public $passwordHistoryLimit = 5; // Number of passwords kept in history + public $passwordHistoryLimit = 5; // Number of passwords kept in history, set to 0 to disable this feature public $passwordMaxLifetime = 90; // Number of days a password can be used public $enforceUppercase = true; // Min 1 uppercase letter public $enforceLowercase = true; // Min 1 lowercase letter public $enforceDigit = true; // Min 1 digit public $enforceSymbol = true; // Min 1 symbol - public $enforceUniquePassword = true; // An password never used before by the user } diff --git a/src/services/Security.php b/src/services/Security.php index f311b3e..28fafd6 100644 --- a/src/services/Security.php +++ b/src/services/Security.php @@ -44,7 +44,7 @@ public function validatePassword(User $user, string $password) $user->addError('newPassword', Craft::t('enforce-password', "Password can't be the same as your username or email.")); } - if ($settings->enforceUniquePassword && EnforcePassword::$plugin->history->isPasswordUsed($user, $password)) { + if (EnforcePassword::$plugin->history->isPasswordUsed($user, $password)) { $user->addError('newPassword', Craft::t('enforce-password', "Please choose a password you didn't use before.")); }