forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchange-password.component.html
70 lines (59 loc) · 3.25 KB
/
change-password.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
~ Copyright (c) 2014-2023 Bjoern Kimminich & the OWASP Juice Shop contributors.
~ SPDX-License-Identifier: MIT
-->
<div fxLayoutAlign="center">
<mat-card class="mat-elevation-z6" style="margin-bottom: 20px;">
<h1 translate>TITLE_CHANGE_PASSWORD</h1>
<div class="confirmation"
[hidden]="!(confirmation && !passwordControl.dirty && !newPasswordControl.dirty && !repeatNewPasswordControl.dirty)">
{{ confirmation }}
</div>
<div class="error"
[hidden]="!(error && !passwordControl.dirty && !newPasswordControl.dirty && !repeatNewPasswordControl.dirty)">
{{ error }}
</div>
<div class="form-container" id="password-form">
<mat-form-field appearance="outline" color="accent">
<mat-label translate>LABEL_CURRENT_PASSWORD</mat-label>
<input id="currentPassword" [formControl]="passwordControl" type="password" matInput
aria-label="Field to enter the current password"
placeholder="{{'MANDATORY_CURRENT_PASSWORD' | translate }}">
<mat-error *ngIf="passwordControl.invalid" translate>MANDATORY_CURRENT_PASSWORD</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" color="accent">
<mat-label translate>LABEL_NEW_PASSWORD</mat-label>
<input #password id="newPassword" [formControl]="newPasswordControl" type="password" matInput
aria-label="Field for the new password">
<mat-hint translate>
<i class="fas fa-exclamation-circle"></i>
<em style="margin-left:5px;" translate>{{ 'INVALID_PASSWORD_LENGTH' | translate: {length: '5-40'} }}</em>
</mat-hint>
<mat-hint align="end">{{password.value?.length || 0}}/40</mat-hint>
<mat-error *ngIf="newPasswordControl?.invalid && newPasswordControl?.errors.required" translate>
MANDATORY_NEW_PASSWORD
</mat-error>
<mat-error
*ngIf="newPasswordControl?.invalid && (newPasswordControl?.errors.minlength || newPasswordControl?.errors.maxlength)"
translate [translateParams]="{length: '5-40'}">INVALID_PASSWORD_LENGTH
</mat-error>
</mat-form-field>
<mat-form-field appearance="outline" color="accent">
<mat-label translate>LABEL_REPEAT_NEW_PASSWORD</mat-label>
<input #passwordRepeat id="newPasswordRepeat" [formControl]="repeatNewPasswordControl" type="password" matInput
aria-label="Field to repeat the new password">
<mat-hint align="end">{{passwordRepeat.value?.length || 0}}/20</mat-hint>
<mat-error *ngIf="repeatNewPasswordControl.invalid && repeatNewPasswordControl.errors.required" translate>MANDATORY_PASSWORD_REPEAT</mat-error>
<mat-error *ngIf="repeatNewPasswordControl.invalid && repeatNewPasswordControl.errors.notSame" translate>
PASSWORDS_NOT_MATCHING
</mat-error>
</mat-form-field>
</div>
<button type="submit" id="changeButton"
[disabled]="passwordControl.invalid || newPasswordControl.invalid || repeatNewPasswordControl.invalid"
mat-raised-button color="primary" (click)="changePassword()" aria-label="Button to confirm the change">
<i class="far fa-edit fa-lg" aria-hidden="true"></i>
{{'BTN_CHANGE' | translate}}
</button>
</mat-card>
</div>