From c5cf678cd0a7e42cf5e9849434d354370e43cf37 Mon Sep 17 00:00:00 2001 From: Tom Lutzenberger <t.lutzenberger@adito.de> Date: Thu, 13 Aug 2020 13:12:56 +0200 Subject: [PATCH] #1058862: Adjust password validation to tools-API --- entity/Employee_entity/entityfields/password/onValidation.js | 4 ++-- .../entityfields/jpassword/onValidation.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/entity/Employee_entity/entityfields/password/onValidation.js b/entity/Employee_entity/entityfields/password/onValidation.js index 09a1493246..c633cac88f 100644 --- a/entity/Employee_entity/entityfields/password/onValidation.js +++ b/entity/Employee_entity/entityfields/password/onValidation.js @@ -8,11 +8,11 @@ import("system.vars"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { let newPassword = vars.get("$local.value"); - let policyMessages = tools.validatePasswordPolicies(newPassword); + let policyMessages = tools.validatePasswordPolicies(newPassword, ""); let messages = []; if(newPassword) { - if(Object.keys(policyMessages).length > 0) { + if(policyMessages.length > 0) { for(let msg in policyMessages) { messages.push(policyMessages[msg]); } diff --git a/entity/Usersettings_entity/entityfields/jpassword/onValidation.js b/entity/Usersettings_entity/entityfields/jpassword/onValidation.js index 8afe8f4de4..ee0296a725 100644 --- a/entity/Usersettings_entity/entityfields/jpassword/onValidation.js +++ b/entity/Usersettings_entity/entityfields/jpassword/onValidation.js @@ -6,7 +6,7 @@ import("system.vars"); let newPassword = vars.get("$local.value"); let currentPassword = vars.get("$field.currentPassword"); -let policyMessages = tools.validatePasswordPolicies(newPassword); +let policyMessages = tools.validatePasswordPolicies(newPassword, vars.get("$sys.user")); let messages = []; if(newPassword) { @@ -14,7 +14,7 @@ if(newPassword) { result.string(translate.text("New password must not be the same as the current password")); } - if(Object.keys(policyMessages).length > 0) { + if(policyMessages.length > 0) { for(let msg in policyMessages) { messages.push(policyMessages[msg]); } -- GitLab