Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: align ui and backend password validation policy #2187

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
{{ 'labels.inputs.Password' | translate }} <strong>{{'labels.commons.is required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="createSelfServiceForm.controls.password.hasError('minlength')">
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.8 characters long' | translate }}</strong>
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.12 characters long' | translate }}</strong>
</mat-error>
<mat-error *ngIf="createSelfServiceForm.controls.password.hasError('maxlength')">
{{'labels.commons.Password should not be more than' | translate }}
Expand All @@ -79,7 +79,7 @@
<mat-error
*ngIf="createSelfServiceForm.controls.password.hasError('pattern') && !(createSelfServiceForm.controls.password.hasError('minlength') || createSelfServiceForm.controls.password.hasError('maxlength'))">
{{'labels.commons.Password should include a' | translate }}
<strong>{{'labels.commons.numeral' | translate }}</strong> {{'labels.commons.and at' | translate }}
<strong>{{'labels.commons.numeral' | translate }}</strong> {{'labels.commons.and at' | translate }}
<strong>{{'labels.commons.least one uppercase' | translate }}</strong>
,<strong>{{'labels.commons.lowercase and special character' | translate }}</strong>
</mat-error>
Expand Down Expand Up @@ -120,4 +120,4 @@

</mat-card>

</div>
</div>
2 changes: 1 addition & 1 deletion src/app/core/utils/passwords-utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Subscription } from 'rxjs';

export class PasswordsUtility {
// password regex pattern
public static PASSWORD_REGEX = '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*[#$@$!%*?&])[A-Za-z\d#$@$!%*?&].{8,}$';
public static PASSWORD_REGEX = '^(?!.*(.)\\1)(?!.*\\s)(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^\\w\\s]).{12,50}$';

public getPasswordValidators(): ValidatorFn[] {
return [Validators.required, Validators.pattern(PasswordsUtility.PASSWORD_REGEX), Validators.maxLength(50), Validators.minLength(8)];
Expand Down
2 changes: 1 addition & 1 deletion src/app/login/reset-password/reset-password.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{{ 'labels.inputs.Password' | translate }} <strong>{{'labels.commons.is required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="resetPasswordForm.controls.password.hasError('minlength')">
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.8 characters long' | translate }}</strong>
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.12 characters long' | translate }}</strong>
</mat-error>
<mat-error *ngIf="resetPasswordForm.controls.password.hasError('maxlength')">
{{'labels.commons.Password should not be more than' | translate }} <strong>{{'labels.commons.50 characters long' | translate }}</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 mat-dialog-title>{{ 'labels.heading.Change Password' | translate }}</h1>
{{ 'labels.inputs.Password' | translate }} <strong>{{'labels.commons.is required' | translate }}</strong>
</mat-error>
<mat-error *ngIf="changePasswordForm.controls.password.hasError('minlength')">
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.8 characters long' | translate }}</strong>
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.12 characters long' | translate }}</strong>
</mat-error>
<mat-error *ngIf="changePasswordForm.controls.password.hasError('maxlength')">
{{'labels.commons.Password should not be more than' | translate }} <strong>{{'labels.commons.50 characters long' | translate }}</strong>
Expand Down
2 changes: 1 addition & 1 deletion src/app/users/create-user/create-user.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{{'labels.inputs.Password' | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
<mat-error *ngIf="userForm.controls.password.hasError('minlength')">
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.8 characters long' | translate }}</strong>
{{'labels.commons.Password should be at least' | translate }} <strong>{{'labels.commons.12 characters long' | translate }}</strong>
</mat-error>
<mat-error *ngIf="userForm.controls.password.hasError('maxlength')">
{{'labels.commons.Password should not be more than' | translate }} <strong>{{'labels.commons.50 characters long' | translate }}</strong>
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/cs-CS.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 znaků dlouhé",
"8 characters long": "8 znaků dlouhé",
"12 characters long": "12 znaků dlouhé",
"Amount must be": "Částka musí být",
"At least one restricted product": "Alespoň jeden omezený produkt",
"At least one role": "Alespoň jednu roli",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 Zeichen lang",
"8 characters long": "8 Zeichen lang",
"12 characters long": "12 Zeichen lang",
"Amount must be": "Betrag muss sein",
"At least one restricted product": "Mindestens ein eingeschränktes Produkt",
"At least one role": "Mindestens eine Rolle",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@
},
"commons": {
"50 characters long": "50 characters long",
"8 characters long": "8 characters long",
"12 characters long": "12 characters long",
"Amount must be": "Amount must be",
"At least one restricted product": "At least one restricted product",
"At least one role": "At least one role",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
},
"commons": {
"50 characters long": "50 caracteres de largo",
"8 characters long": "8 caracteres de largo",
"12 characters long": "12 caracteres de largo",
"Amount must be": "La cantidad debe ser",
"At least one restricted product": "Al menos un producto restringido",
"At least one role": "Al menos un rol",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 caractères",
"8 characters long": "8 caractères",
"12 characters long": "12 caractères",
"Amount must be": "Le montant doit être",
"At least one restricted product": "Au moins un produit restreint",
"At least one role": "Au moins un rôle",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 caratteri di lunghezza",
"8 characters long": "8 caratteri di lunghezza",
"12 characters long": "12 caratteri di lunghezza",
"Amount must be": "L'importo deve essere",
"At least one restricted product": "Almeno un prodotto limitato",
"At least one role": "Almeno un ruolo",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/ko-KO.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50자(영문 기준)",
"8 characters long": "8자 길이",
"12 characters long": "12자 길이",
"Amount must be": "금액은 다음과 같아야 합니다.",
"At least one restricted product": "하나 이상의 제한된 제품",
"At least one role": "역할이 하나 이상",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 simbolių ilgio",
"8 characters long": "8 simbolių ilgio",
"12 characters long": "12 simbolių ilgio",
"Amount must be": "Suma turi būti",
"At least one restricted product": "Bent vienas ribojamas produktas",
"At least one role": "Bent vienas vaidmuo",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/lv-LV.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 rakstzīmes garš",
"8 characters long": "8 rakstzīmes garš",
"12 characters long": "12 rakstzīmes garš",
"Amount must be": "Summai jābūt",
"At least one restricted product": "Vismaz viens ierobežots produkts",
"At least one role": "Vismaz viena loma",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/ne-NE.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "५० वर्ण लामो",
"8 characters long": "8 वर्ण लामो",
"12 characters long": "12 वर्ण लामो",
"Amount must be": "रकम हुनुपर्छ",
"At least one restricted product": "कम्तिमा एक प्रतिबन्धित उत्पादन",
"At least one role": "कम्तिमा एक भूमिका",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "50 caracteres",
"8 characters long": "8 caracteres de comprimento",
"12 characters long": "12 caracteres de comprimento",
"Amount must be": "O valor deve ser",
"At least one restricted product": "Pelo menos um produto restrito",
"At least one role": "Pelo menos um papel",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/translations/sw-SW.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
},
"commons": {
"50 characters long": "Urefu wa herufi 50",
"8 characters long": "Urefu wa herufi 8",
"12 characters long": "Urefu wa herufi 12",
"Amount must be": "Kiasi lazima kiwe",
"At least one restricted product": "Angalau bidhaa moja iliyozuiliwa",
"At least one role": "Angalau jukumu moja",
Expand Down
Loading