Fixed server exception on password change.

This commit is contained in:
Ylian Saint-Hilaire 2020-08-20 15:33:12 -07:00
parent 474939bc64
commit acd54b30c8
2 changed files with 154 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1873,7 +1873,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Callback: 0=OK, 1=OldPass, 2=CommonPass
obj.checkOldUserPasswords = function (domain, user, password, func) {
// Check how many old passwords we need to check
if ((typeof domain.passwordrequirements.oldpasswordban == 'number') && (domain.passwordrequirements.oldpasswordban > 0)) {
if ((domain.passwordrequirements != null) && (typeof domain.passwordrequirements.oldpasswordban == 'number') && (domain.passwordrequirements.oldpasswordban > 0)) {
if (user.oldpasswords != null) {
const extraOldPasswords = user.oldpasswords.length - domain.passwordrequirements.oldpasswordban;
if (extraOldPasswords > 0) { user.oldpasswords.splice(0, extraOldPasswords); }