fix: add hint for password-confirmation (#1863)

* fix:add hint for password-confirmation

* Update internal/ui/login/static/i18n/de.yaml

Co-authored-by: Fabi <[email protected]>

Co-authored-by: Fabi <[email protected]>
This commit is contained in:
you1996
2021-06-17 15:46:32 +02:00
committed by GitHub
co-authored by Fabi
parent 32f8545082
commit fd04fb58d0
9 changed files with 25 additions and 13 deletions
@@ -3,7 +3,7 @@ function CheckChangePwPolicy() {
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("change-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) {
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn");
return false;
} else {
@@ -3,7 +3,7 @@ function CheckInitPwPolicy() {
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("passwordconfirm").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) {
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
return false;
}
@@ -1,4 +1,4 @@
function ComplexityPolicyCheck(policyElement, pwNew) {
function ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) {
let minLength = policyElement.dataset.minlength;
let upperRegex = policyElement.dataset.hasUppercase;
let lowerRegex = policyElement.dataset.hasLowercase;
@@ -55,6 +55,14 @@ function ComplexityPolicyCheck(policyElement, pwNew) {
valid = false;
}
}
let confirmation = document.getElementById('confirmation');
if (pwNew === pwNewConfirmation && pwNewConfirmation !== "" ) {
ValidPolicy(confirmation);
valid = true;
} else {
InvalidPolicy(confirmation);
valid = false;
}
return valid;
}
@@ -3,7 +3,7 @@ function CheckRegisterPwPolicy() {
let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("register-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) {
if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn");
return false;
} else {