Cannot change password when maxPasswordHistory is 1 (#5191)

* Negitive to zero and positive to same value

* add failing test
This commit is contained in:
Tulsi Sapkota
2019-04-10 22:57:09 +05:45
committed by Arthur Cinader
parent c7eb7daeae
commit a3746cab00
2 changed files with 35 additions and 1 deletions

View File

@@ -1284,7 +1284,7 @@ RestWrite.prototype.runDatabaseOperation = function() {
//n-1 passwords go into history including last password
while (
oldPasswords.length >
this.config.passwordPolicy.maxPasswordHistory - 2
Math.max(0, this.config.passwordPolicy.maxPasswordHistory - 2)
) {
oldPasswords.shift();
}