Skip to content

Commit

Permalink
enforceUniquePassword removed
Browse files Browse the repository at this point in the history
  • Loading branch information
codename-niels committed Jan 26, 2021
1 parent d10769b commit 1718a65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
```

Expand Down
3 changes: 1 addition & 2 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion src/services/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
}

Expand Down

0 comments on commit 1718a65

Please sign in to comment.