diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index d3ae09d5ecc8488205f9cf7d5899dd1f0fa6cfb7..ed1770b8c1d07cf31bd6b90660ecf0bf031ab25a 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -71,6 +71,7 @@ <contentType>PASSWORD</contentType> <mandatoryProcess>%aditoprj%/entity/Employee_entity/entityfields/password/mandatoryProcess.js</mandatoryProcess> <stateProcess>%aditoprj%/entity/Employee_entity/entityfields/password/stateProcess.js</stateProcess> + <onValidation>%aditoprj%/entity/Employee_entity/entityfields/password/onValidation.js</onValidation> </entityField> <entityField> <name>CONFIRM_PASSWORD</name> diff --git a/entity/Employee_entity/entityfields/password/onValidation.js b/entity/Employee_entity/entityfields/password/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..594e4ab70407bdbeb162e34819ae0b93bc41c9c4 --- /dev/null +++ b/entity/Employee_entity/entityfields/password/onValidation.js @@ -0,0 +1,23 @@ +import("system.neon"); +import("system.result"); +import("system.translate"); +import("system.tools"); +import("system.vars"); + + +// Because employee password can only be set on new records +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { + + let newPassword = vars.get("$local.value"); + let policyMessages = tools.validatePasswordPolicies(newPassword); + let messages = []; + + if(newPassword) { + if(Object.keys(policyMessages).length > 0) { + for(let msg in policyMessages) { + messages.push(translate.withArguments(msg, policyMessages[msg])); + } + result.string(messages.join("\n", messages)); + } + } +} diff --git a/entity/Usersettings_entity/entityfields/jpassword/onValidation.js b/entity/Usersettings_entity/entityfields/jpassword/onValidation.js index 26773ba48b7bd02eb4d2d332d3bf6c7f48ea298c..818627863068e020623a713930385419bc032e1c 100644 --- a/entity/Usersettings_entity/entityfields/jpassword/onValidation.js +++ b/entity/Usersettings_entity/entityfields/jpassword/onValidation.js @@ -1,13 +1,23 @@ import("system.result"); import("system.translate"); +import("system.tools"); import("system.vars"); let newPassword = vars.get("$local.value"); let currentPassword = vars.get("$field.currentPassword"); +let policyMessages = tools.validatePasswordPolicies(newPassword); +let messages = []; if(newPassword) { if(newPassword === currentPassword) { result.string(translate.text("New password must not be the same as the current password")); } + + if(Object.keys(policyMessages).length > 0) { + for(let msg in policyMessages) { + messages.push(translate.withArguments(msg, policyMessages[msg])); + } + result.string(messages.join("\n", messages)); + } } diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 19d06a930f93755fcb8c079433e895e870ff6aee..6c1dddac6ac6625922e36b67c251ac248b3e9fd7 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6893,6 +6893,24 @@ <entry> <key>Workflow Model</key> </entry> + <entry> + <key>Password must contain special characters</key> + </entry> + <entry> + <key>Password must contain numbers</key> + </entry> + <entry> + <key>Password must contain letters</key> + </entry> + <entry> + <key>Password must contain spaces</key> + </entry> + <entry> + <key>Password must be at least %0 characters</key> + </entry> + <entry> + <key>The use of any of your previous %0 passwords is prohibited</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 4e124f18e5dc6a659eba557199cc24d5f83688bf..c5cf76e00991ed857ed382eb5d19228b0ad687d5 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -8833,6 +8833,30 @@ Bitte Datumseingabe prüfen</value> <entry> <key>Workflow Model</key> </entry> + <entry> + <key>The use of any of your previous %0 passwords is prohibited</key> + <value>Die Verwendung eines Ihrer vorherigen %0 Passwörter ist untersagt</value> + </entry> + <entry> + <key>Password must be at least %0 characters</key> + <value>Passwort muss aus mindestens %0 Zeichen bestehen</value> + </entry> + <entry> + <key>Password must contain letters</key> + <value>Passwort muss Buchstaben enhalten</value> + </entry> + <entry> + <key>Password must contain numbers</key> + <value>Passwort muss Zahlen enhalten</value> + </entry> + <entry> + <key>Password must contain spaces</key> + <value>Passwort muss Leerzeichen enhalten</value> + </entry> + <entry> + <key>Password must contain special characters</key> + <value>Passwort muss Sonderzeichen enhalten</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 8beaf1c84303ed995ed64bd42dd05b9116ec8325..6ba7f62f9320a7a844c63f7de01ad4baf995c54f 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6959,6 +6959,24 @@ <entry> <key>Workflow Model</key> </entry> + <entry> + <key>Password must contain special characters</key> + </entry> + <entry> + <key>Password must contain numbers</key> + </entry> + <entry> + <key>Password must contain letters</key> + </entry> + <entry> + <key>Password must contain spaces</key> + </entry> + <entry> + <key>Password must be at least %0 characters</key> + </entry> + <entry> + <key>The use of any of your previous %0 passwords is prohibited</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language>