Skip to content

Commit 6c60d93

Browse files
Merge pull request #530 from PermanentOrg/PER-9982-hitting-enter-submit-2fa-code
PER-9982 hitting enter submit 2fa code
2 parents 6fc5aef + eef846d commit 6c60d93

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/app/core/components/two-factor-auth/two-factor-auth.component.html

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@
5050
<option [disabled]="hasMethod('email')" value="email">Email</option>
5151
<option [disabled]="hasMethod('sms')" value="sms">SMS</option>
5252
</select>
53-
<form *ngIf="method" [formGroup]="form" (submit)="submitData(form.value)">
53+
<form
54+
class="send-code-form"
55+
*ngIf="method"
56+
[formGroup]="form"
57+
(submit)="sendCode(form.value)"
58+
>
5459
<p *ngIf="!selectedMethodToDelete">
5560
2. Enter your contact information for the preferred method below and click
5661
the button to send a one-time use code.
@@ -85,15 +90,17 @@
8590
</div>
8691
<div class="send-code-button button-container">
8792
<button
93+
type="submit"
8894
role="button"
8995
[disabled]="!form.value.contactInfo || form.get('contactInfo').errors"
90-
(click)="sendCode($event)"
9196
class="btn btn-primary"
9297
>
9398
Send Code
9499
</button>
95100
</div>
96-
<div class="code-container" *ngIf="codeSent">
101+
</form>
102+
<div class="code-container" *ngIf="codeSent">
103+
<form (submit)="submitData(form.value)">
97104
<p>3. Enter the four digit code below</p>
98105
<div class="input-group-vertical">
99106
<pr-form-input
@@ -105,14 +112,16 @@
105112
</div>
106113
<div class="button-container button-group">
107114
<button
108-
type="submit"
109115
[disabled]="!form.value.code"
110116
class="btn btn-primary"
117+
type="submit"
111118
>
112119
{{ selectedMethodToDelete ? 'Delete' : 'Enable' }}
113120
</button>
114-
<button class="btn btn-secondary" (click)="cancel()">Cancel</button>
121+
<button type="button" class="btn btn-secondary" (click)="cancel()">
122+
Cancel
123+
</button>
115124
</div>
116-
</div>
117-
</form>
125+
</form>
126+
</div>
118127
</div>

src/app/core/components/two-factor-auth/two-factor-auth.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export class TwoFactorAuthComponent implements OnInit {
4747
this.formatPhoneNumber(value);
4848
}
4949
});
50+
51+
this.form.get('code').valueChanges.subscribe(() => {});
5052
}
5153

5254
async ngOnInit() {
@@ -108,8 +110,6 @@ export class TwoFactorAuthComponent implements OnInit {
108110
}
109111

110112
async sendCode(e) {
111-
e.preventDefault();
112-
113113
try {
114114
if (this.selectedMethodToDelete) {
115115
await this.api.idpuser.sendDisableCode(

0 commit comments

Comments
 (0)