|
1 | 1 | <form |
2 | 2 | [formGroup]="parentForm" |
3 | 3 | (ngSubmit)="onSubmit()" |
4 | | - class="container" |
| 4 | + [ngClass]="{ container: data }" |
5 | 5 | [tabindex]="-1" |
6 | 6 | > |
7 | 7 | @if (loading) { |
8 | | - <mat-progress-bar mode="indeterminate"></mat-progress-bar> |
| 8 | + <mat-progress-bar |
| 9 | + mode="indeterminate" |
| 10 | + [ngClass]="{ progress: !data }" |
| 11 | + ></mat-progress-bar> |
9 | 12 | } |
10 | 13 | <div |
11 | 14 | class="icon self-center w-16 h-16 mb-8 content-center ml-auto mr-auto rounded-[50%] text-center" |
12 | 15 | > |
13 | 16 | <mat-icon class="material-symbols-outlined">person_check</mat-icon> |
14 | 17 | </div> |
15 | | - <h1 |
16 | | - class="orc-font-heading-small text-center font-normal" |
17 | | - cdkFocusInitial |
18 | | - i18n |
19 | | - > |
| 18 | + <h1 class="orc-font-heading-small text-center font-normal" i18n> |
20 | 19 | Verify your ORCID account |
21 | 20 | </h1> |
22 | 21 | <p class="orc-font-body-small text-center mb-8"> |
23 | | - <span i18n>Enter</span> @if (data.showPasswordField) {<ng-container |
24 | | - i18n |
| 22 | + <span i18n>Enter</span> @if (showPasswordField) {<ng-container i18n |
25 | 23 | >your ORCID account password</ng-container |
26 | | - > }@if (data.showPasswordField && data.showTwoFactorField) |
27 | | - {<ng-container i18n>and</ng-container> }@if (data.showTwoFactorField) |
28 | | - {<ng-container i18n>a two-factor authentication code</ng-container |
29 | | - > }to {{ data.actionDescription }}@if (data.memberName) { <b |
30 | | - >{{ data.memberName }}</b |
31 | | - >} |
| 24 | + > }@if (showPasswordField && showTwoFactorField) {<ng-container i18n |
| 25 | + >and</ng-container |
| 26 | + > }@if (showTwoFactorField) {<ng-container i18n |
| 27 | + >a two-factor authentication code</ng-container |
| 28 | + > }to {{ actionDescription }}@if (boldText) { <b>{{ |
| 29 | + boldText |
| 30 | + }}</b |
| 31 | + >}@if (trailingText) { {{ trailingText }}} |
32 | 32 | </p> |
33 | 33 |
|
34 | | - @if (data.showPasswordField) { |
| 34 | + @if (showPasswordField) { |
35 | 35 | <div class="row mb-6 flex flex-wrap"> |
36 | 36 | <mat-label |
37 | 37 | class="orc-font-small-print block mb-2!" |
38 | 38 | id="password-input-label" |
39 | 39 | [ngClass]="{ |
40 | 40 | error: |
41 | | - parentForm.get(data.passwordControlName)?.invalid && |
42 | | - passwordWasTouched |
| 41 | + parentForm.get(passwordControlName)?.invalid && passwordWasTouched |
43 | 42 | }" |
44 | 43 | > |
45 | 44 | <strong i18n="@@register.password">Password</strong> |
|
51 | 50 | <input |
52 | 51 | matInput |
53 | 52 | #passwordInput |
54 | | - [formControlName]="data.passwordControlName" |
| 53 | + [formControlName]="passwordControlName" |
55 | 54 | id="password" |
56 | 55 | type="password" |
57 | 56 | aria-labelledby="password-input-label" |
58 | 57 | [errorStateMatcher]="errorMatcher" |
59 | 58 | [ngClass]="{ |
60 | 59 | error: |
61 | | - parentForm.get(data.passwordControlName)?.invalid && |
62 | | - passwordWasTouched |
| 60 | + parentForm.get(passwordControlName)?.invalid && passwordWasTouched |
63 | 61 | }" |
64 | 62 | /> |
65 | 63 | </mat-form-field> |
66 | 64 |
|
67 | | - @if (parentForm.get(data.passwordControlName)?.hasError('required') && |
| 65 | + @if (parentForm.get(passwordControlName)?.hasError('required') && |
68 | 66 | passwordWasTouched) { |
69 | 67 | <mat-error |
70 | 68 | class="w-full orc-font-small-print mt-2" |
71 | 69 | i18n="@@account.passwordCannotBeEmpty" |
72 | 70 | > |
73 | 71 | Password cannot be empty |
74 | 72 | </mat-error> |
75 | | - } @if (parentForm.get(data.passwordControlName)?.hasError('invalid')) { |
| 73 | + } @if (parentForm.get(passwordControlName)?.hasError('invalid')) { |
76 | 74 | <mat-error class="w-full orc-font-small-print mt-2" i18n> |
77 | 75 | The password does not match our records |
78 | 76 | </mat-error> |
79 | 77 | } |
80 | 78 | </div> |
81 | | - } @if (data.showTwoFactorField) { @if (!showRecoveryCode) { |
| 79 | + } @if (showTwoFactorField) { @if (!showRecoveryCode) { |
82 | 80 | <div> |
83 | 81 | <mat-label |
84 | | - class="orc-font-small-print font-bold! block mb-2!" |
| 82 | + class="orc-font-small-print font-bold! block mb-2! text-left" |
85 | 83 | id="2fa-input-label" |
86 | 84 | i18n="@@account.twoPassword" |
87 | 85 | [ngClass]="{ |
88 | 86 | error: |
89 | | - twoFactorCodeWasTouched && |
90 | | - parentForm.get(data.codeControlName)?.invalid |
| 87 | + twoFactorCodeWasTouched && parentForm.get(codeControlName)?.invalid |
91 | 88 | }" |
92 | 89 | > |
93 | 90 | Two-factor authentication |
|
102 | 99 | type="text" |
103 | 100 | inputmode="numeric" |
104 | 101 | aria-labelledby="2fa-input-label" |
105 | | - [formControlName]="data.codeControlName" |
| 102 | + [formControlName]="codeControlName" |
106 | 103 | matInput |
107 | 104 | [errorStateMatcher]="errorMatcher" |
108 | 105 | #twoFactorCodeInput |
109 | 106 | [ngClass]="{ |
110 | 107 | error: |
111 | | - twoFactorCodeWasTouched && |
112 | | - parentForm.get(data.codeControlName)?.invalid |
| 108 | + twoFactorCodeWasTouched && parentForm.get(codeControlName)?.invalid |
113 | 109 | }" |
114 | 110 | /> |
115 | 111 | </mat-form-field> |
116 | 112 | <div class="flex orc-font-small-print"> |
117 | | - <div class="mt-2 grow"> |
118 | | - @if (!parentForm.get(data.codeControlName)?.invalid || |
| 113 | + <div class="mt-2 grow text-left"> |
| 114 | + @if (!parentForm.get(codeControlName)?.invalid || |
119 | 115 | !twoFactorCodeWasTouched) { |
120 | 116 | <mat-hint class="leading-6" i18n="@@account.enterTheCode"> |
121 | 117 | Enter the code from your two-factor authentication app |
122 | 118 | </mat-hint> |
123 | | - } @if (parentForm.get(data.codeControlName)?.hasError('invalid')) { |
| 119 | + } @if (parentForm.get(codeControlName)?.hasError('invalid')) { |
124 | 120 | <mat-error> |
125 | 121 | <ng-container i18n="@@ngOrcid.signin.2fa.badVerificationCode"> |
126 | 122 | Invalid authentication code |
127 | 123 | </ng-container> |
128 | 124 | </mat-error> |
129 | 125 | } @if ( twoFactorCodeWasTouched && |
130 | | - parentForm.get(data.codeControlName)?.hasError('required')) { |
| 126 | + parentForm.get(codeControlName)?.hasError('required')) { |
131 | 127 | <mat-error> |
132 | 128 | <ng-container i18n="@@ngOrcid.signin.2fa.verificationCodeRequired"> |
133 | 129 | Authentication code is required |
134 | 130 | </ng-container> |
135 | 131 | </mat-error> |
136 | 132 | } @if ( twoFactorCodeWasTouched && |
137 | | - (parentForm.get(data.codeControlName)?.hasError('minlength') || |
138 | | - parentForm.get(data.codeControlName)?.hasError('maxlength'))) { |
| 133 | + (parentForm.get(codeControlName)?.hasError('minlength') || |
| 134 | + parentForm.get(codeControlName)?.hasError('maxlength'))) { |
139 | 135 | <mat-error> |
140 | 136 | <ng-container i18n="@@ngOrcid.signin.2fa.badVerificationCodeLength"> |
141 | 137 | Invalid authentication code length |
|
146 | 142 | <mat-hint |
147 | 143 | [ngClass]="{ |
148 | 144 | error: |
149 | | - twoFactorCodeWasTouched && |
150 | | - parentForm.get(data.codeControlName)?.invalid |
| 145 | + twoFactorCodeWasTouched && parentForm.get(codeControlName)?.invalid |
151 | 146 | }" |
152 | 147 | class="mt-2 self-center leading-6" |
153 | 148 | > |
154 | | - {{ parentForm.get(data.codeControlName)?.value?.length || 0 }}/6 |
| 149 | + {{ parentForm.get(codeControlName)?.value?.length || 0 }}/6 |
155 | 150 | </mat-hint> |
156 | 151 | </div> |
157 | 152 | </div> |
158 | 153 | } @else { |
159 | 154 | <div> |
160 | 155 | <mat-label |
161 | | - class="orc-font-small-print font-bold! block mb-2!" |
| 156 | + class="orc-font-small-print font-bold! block mb-2! text-left" |
162 | 157 | id="recovery-input-label" |
163 | 158 | i18n="@@ngOrcid.signin.2fa.recoveryCode" |
164 | 159 | [ngClass]="{ |
165 | 160 | error: |
166 | 161 | twoFactorRecoveryCodeWasTouched && |
167 | | - parentForm.get(data.recoveryControlName)?.invalid |
| 162 | + parentForm.get(recoveryControlName)?.invalid |
168 | 163 | }" |
169 | 164 | > |
170 | 165 | Recovery code |
|
179 | 174 | type="text" |
180 | 175 | inputmode="numeric" |
181 | 176 | aria-labelledby="recovery-input-label" |
182 | | - [formControlName]="data.recoveryControlName" |
| 177 | + [formControlName]="recoveryControlName" |
183 | 178 | #twoFactorRecoveryCodeInput |
184 | 179 | [errorStateMatcher]="errorMatcher" |
185 | 180 | matInput |
186 | 181 | [ngClass]="{ |
187 | 182 | error: |
188 | 183 | twoFactorRecoveryCodeWasTouched && |
189 | | - parentForm.get(data.recoveryControlName)?.invalid |
| 184 | + parentForm.get(recoveryControlName)?.invalid |
190 | 185 | }" |
191 | 186 | /> |
192 | 187 | </mat-form-field> |
193 | 188 | <div class="flex orc-font-small-print"> |
194 | | - <div class="mt-2 grow"> |
195 | | - @if (!parentForm.get(data.recoveryControlName)?.invalid || |
| 189 | + <div class="mt-2 grow text-left"> |
| 190 | + @if (!parentForm.get(recoveryControlName)?.invalid || |
196 | 191 | !twoFactorRecoveryCodeWasTouched) { |
197 | 192 | <mat-hint class="leading-6" i18n="@@ngOrcid.signin.2fa.noDevice2" |
198 | 193 | >Enter a recovery code</mat-hint |
199 | 194 | > |
200 | | - } @if (parentForm.get(data.recoveryControlName)?.hasError('invalid')) { |
| 195 | + } @if (parentForm.get(recoveryControlName)?.hasError('invalid')) { |
201 | 196 | <mat-error> |
202 | 197 | <ng-container i18n="@@ngOrcid.signin.2fa.badRecoveryCode"> |
203 | 198 | Invalid recovery code |
204 | 199 | </ng-container> |
205 | 200 | </mat-error> |
206 | 201 | } @if (twoFactorRecoveryCodeWasTouched && |
207 | | - parentForm.get(data.recoveryControlName)?.hasError('required')) { |
| 202 | + parentForm.get(recoveryControlName)?.hasError('required')) { |
208 | 203 | <mat-error> |
209 | 204 | <ng-container i18n="@@ngOrcid.signin.2fa.recoveryCodeRequired"> |
210 | 205 | Recovery code is required |
211 | 206 | </ng-container> |
212 | 207 | </mat-error> |
213 | 208 | } @if (twoFactorRecoveryCodeWasTouched && |
214 | | - (parentForm.get(data.recoveryControlName)?.hasError('minlength') || |
215 | | - parentForm.get(data.recoveryControlName)?.hasError('maxlength'))) { |
| 209 | + (parentForm.get(recoveryControlName)?.hasError('minlength') || |
| 210 | + parentForm.get(recoveryControlName)?.hasError('maxlength'))) { |
216 | 211 | <mat-error> |
217 | 212 | <ng-container i18n="@@ngOrcid.signin.2fa.badRecoveryCodeLength"> |
218 | 213 | Invalid recovery code length |
|
224 | 219 | [ngClass]="{ |
225 | 220 | error: |
226 | 221 | twoFactorRecoveryCodeWasTouched && |
227 | | - parentForm.get(data.recoveryControlName)?.invalid |
| 222 | + parentForm.get(recoveryControlName)?.invalid |
228 | 223 | }" |
229 | 224 | class="mt-2 self-center leading-6" |
230 | 225 | > |
231 | | - {{ parentForm.get(data.recoveryControlName)?.value?.length || 0 }}/10 |
| 226 | + {{ parentForm.get(recoveryControlName)?.value?.length || 0 }}/10 |
232 | 227 | </mat-hint> |
233 | 228 | </div> |
234 | 229 | </div> |
|
262 | 257 | Use your authentication app instead |
263 | 258 | </a> |
264 | 259 | </div> |
265 | | - } <br /> |
| 260 | + } |
266 | 261 | <div class="text-center orc-font-body-small mt-4"> |
267 | 262 | <p i18n="@@ngOrcid.signin.2fa.noDeviceOrRecovery" class="m-0 leading-6"> |
268 | 263 | Don't have your device or recovery code? |
|
296 | 291 | <button |
297 | 292 | mat-button |
298 | 293 | type="button" |
299 | | - mat-dialog-close |
| 294 | + (click)="onCancel()" |
300 | 295 | class="text-center orc-font-body-small h-10! w-full block content-center cancel font-normal!" |
301 | 296 | i18n |
302 | 297 | > |
|
0 commit comments