Skip to content

Commit 8563198

Browse files
feat: enable autocomplete for one-time-code (#2749)
* feat: enable autocomplete for one-time-code Add HTML attributes to enable autofill by password managers. * Code review changes: one-time code fields will behave consistently --------- Co-authored-by: Angel Montenegro <a.montenegro@orcid.org>
1 parent 985dea3 commit 8563198

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/app/account-settings/pages/confirm-deactivate-account/confirm-deactivate-account.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@
128128
>
129129
<input
130130
id="twoFactorCode"
131-
type="text"
131+
autocomplete="one-time-code"
132132
inputmode="numeric"
133+
name="totp"
133134
aria-labelledby="2fa-input-label"
134135
formControlName="twoFactorCode"
135136
matInput

src/app/cdk/two-factor-authentication-form/two-factor/two-factor-authentication-form.component.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="input-container">
33
<mat-label
44
class="orc-font-small-print"
5+
for="totp"
56
i18n="@@ngOrcid.signin.2fa.label"
67
[ngClass]="{
78
error: isVerificationCodeInvalid
@@ -20,7 +21,11 @@
2021
formControlName="verificationCode"
2122
cdkFocusInitial
2223
appTrim
23-
autocomplete="off"
24+
autocomplete="one-time-code"
25+
id="totp"
26+
inputmode="numeric"
27+
name="totp"
28+
type="text"
2429
/>
2530
</mat-form-field>
2631
<ng-container *ngIf="!recoveryCode">
@@ -119,7 +124,10 @@
119124
#inputRecoveryCode
120125
formControlName="recoveryCode"
121126
appTrim
122-
autocomplete="off"
127+
autocomplete="one-time-code"
128+
inputmode="numeric"
129+
name="totp"
130+
type="text"
123131
/>
124132
</mat-form-field>
125133
<ng-container *ngIf="recoveryCode">

src/app/two-factor-setup/components/two-factor-enable/two-factor-enable.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@
117117
#inputVerificationCode
118118
formControlName="verificationCode"
119119
appTrim
120-
autocomplete="off"
120+
autocomplete="one-time-code"
121+
id="totp"
122+
inputmode="numeric"
123+
name="totp"
124+
type="text"
121125
data-cy="verification-code-input"
122126
/>
123127
<mat-hint align="end"

0 commit comments

Comments
 (0)