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 <38692350+fgerschwiler@users.noreply.github.com>

Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
This commit is contained in:
you1996
2021-06-17 14:46:32 +01:00
committed by GitHub
parent 32f8545082
commit fd04fb58d0
9 changed files with 25 additions and 13 deletions

View File

@@ -1231,7 +1231,7 @@
}, },
"BASIC": { "BASIC": {
"TITLE": "Basic", "TITLE": "Basic",
"DESCRIPTION": "Authentication with Username and Passwort" "DESCRIPTION": "Authentication with Username and Password"
}, },
"IMPLICIT": { "IMPLICIT": {
"TITLE": "Implicit", "TITLE": "Implicit",

View File

@@ -76,7 +76,7 @@ Errors:
Password: Password:
NotFound: Passoword not found NotFound: Passoword not found
Empty: Password is empty Empty: Password is empty
Invalid: Passwort is invalid Invalid: Password is invalid
NotSet: User has not set a password NotSet: User has not set a password
PasswordComplexityPolicy: PasswordComplexityPolicy:
NotFound: Password policy not found NotFound: Password policy not found
@@ -174,9 +174,9 @@ Errors:
AlreadyExists: Password Complexity Policy already exists AlreadyExists: Password Complexity Policy already exists
PasswordLockout: PasswordLockout:
NotFound: Password Lockout Policy not found NotFound: Password Lockout Policy not found
Empty: Passwort Lockout Policy is empty Empty: Password Lockout Policy is empty
NotExisting: Passwort Lockout Policy doesn't exist NotExisting: Password Lockout Policy doesn't exist
AlreadyExists: Passwort Lockout Policy already exists AlreadyExists: Password Lockout Policy already exists
PasswordAge: PasswordAge:
NotFound: Password Age Policy not found NotFound: Password Age Policy not found
Empty: Password Age Policy is empty Empty: Password Age Policy is empty

View File

@@ -66,6 +66,8 @@ func (l *Login) generatePolicyDescription(r *http.Request, policy *iam_model.Pas
hassymbol := l.renderer.LocalizeFromRequest(r, "Password.HasSymbol", nil) hassymbol := l.renderer.LocalizeFromRequest(r, "Password.HasSymbol", nil)
description += "<li id=\"symbol\" class=\"invalid\"><i class=\"lgn-icon-times-solid lgn-warn\"></i><span>" + hassymbol + "</span></li>" description += "<li id=\"symbol\" class=\"invalid\"><i class=\"lgn-icon-times-solid lgn-warn\"></i><span>" + hassymbol + "</span></li>"
} }
confirmation := l.renderer.LocalizeFromRequest(r, "Password.Confirmation", nil)
description += "<li id=\"confirmation\" class=\"invalid\"><i class=\"lgn-icon-times-solid lgn-warn\"></i><span>" + confirmation + "</span></li>"
description += "</ul>" description += "</ul>"
return description, nil return description, nil

View File

@@ -28,6 +28,7 @@ Password:
HasLowercase: Kleinbuchstaben HasLowercase: Kleinbuchstaben
HasNumber: Nummer HasNumber: Nummer
HasSymbol: Symbol HasSymbol: Symbol
Confirmation: Bestätigung stimmt überein
UsernameChange: UsernameChange:
Title: Usernamen ändern Title: Usernamen ändern

View File

@@ -28,6 +28,7 @@ Password:
HasLowercase: Lowercase letter HasLowercase: Lowercase letter
HasNumber: Number HasNumber: Number
HasSymbol: Symbol HasSymbol: Symbol
Confirmation: Confirmation match
UsernameChange: UsernameChange:
Title: Change Username Title: Change Username
@@ -52,7 +53,7 @@ InitPassword:
NewPasswordConfirm: Confirm Password NewPasswordConfirm: Confirm Password
InitPasswordDone: InitPasswordDone:
Title: Passwortd set Title: Password set
Description: Password successfully set Description: Password successfully set
InitUser: InitUser:
@@ -103,7 +104,7 @@ WebAuthN:
Retry: Retry, create a new challenge or choose a different method. Retry: Retry, create a new challenge or choose a different method.
Passwordless: Passwordless:
Title: Login passwordles Title: Login passwordless
Description: Verify your token Description: Verify your token
PasswordChange: PasswordChange:
@@ -111,7 +112,7 @@ PasswordChange:
Description: Change your password. Enter your old and new password. Description: Change your password. Enter your old and new password.
OldPassword: Old Password OldPassword: Old Password
NewPassword: New Password NewPassword: New Password
NewPasswordConfirmation: Passwort confirmation NewPasswordConfirmation: Password confirmation
PasswordChangeDone: PasswordChangeDone:
Title: Change Password Title: Change Password
@@ -251,7 +252,7 @@ Errors:
Password: Password:
ConfirmationWrong: Passwordconfirmation is wrong ConfirmationWrong: Passwordconfirmation is wrong
Empty: Password is empty Empty: Password is empty
Invalid: Passwort is invalid Invalid: Password is invalid
PasswordComplexityPolicy: PasswordComplexityPolicy:
NotFound: Password policy not found NotFound: Password policy not found
MinLength: Password is to short MinLength: Password is to short

View File

@@ -3,7 +3,7 @@ function CheckChangePwPolicy() {
let pwNew = policyElement.value; let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("change-password-confirmation").value; let pwNewConfirmation = document.getElementById("change-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) { if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn"); policyElement.setAttribute("color", "warn");
return false; return false;
} else { } else {

View File

@@ -3,7 +3,7 @@ function CheckInitPwPolicy() {
let pwNew = policyElement.value; let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("passwordconfirm").value; let pwNewConfirmation = document.getElementById("passwordconfirm").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) { if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
return false; return false;
} }

View File

@@ -1,4 +1,4 @@
function ComplexityPolicyCheck(policyElement, pwNew) { function ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) {
let minLength = policyElement.dataset.minlength; let minLength = policyElement.dataset.minlength;
let upperRegex = policyElement.dataset.hasUppercase; let upperRegex = policyElement.dataset.hasUppercase;
let lowerRegex = policyElement.dataset.hasLowercase; let lowerRegex = policyElement.dataset.hasLowercase;
@@ -55,6 +55,14 @@ function ComplexityPolicyCheck(policyElement, pwNew) {
valid = false; valid = false;
} }
} }
let confirmation = document.getElementById('confirmation');
if (pwNew === pwNewConfirmation && pwNewConfirmation !== "" ) {
ValidPolicy(confirmation);
valid = true;
} else {
InvalidPolicy(confirmation);
valid = false;
}
return valid; return valid;
} }

View File

@@ -3,7 +3,7 @@ function CheckRegisterPwPolicy() {
let pwNew = policyElement.value; let pwNew = policyElement.value;
let pwNewConfirmation = document.getElementById("register-password-confirmation").value; let pwNewConfirmation = document.getElementById("register-password-confirmation").value;
if (ComplexityPolicyCheck(policyElement, pwNew) === false) { if (ComplexityPolicyCheck(policyElement, pwNew, pwNewConfirmation) === false) {
policyElement.setAttribute("color", "warn"); policyElement.setAttribute("color", "warn");
return false; return false;
} else { } else {