From 5ccf5584b881ab7bbad8b82e4082c7e681784fe1 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Fri, 5 May 2023 10:33:39 +0200 Subject: [PATCH] [PM-2135] feat: refactor user-verification component --- .../user-verification.component.html | 51 +++++++++---------- .../components/user-verification.component.ts | 8 +-- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/apps/web/src/app/components/user-verification/user-verification.component.html b/apps/web/src/app/components/user-verification/user-verification.component.html index b90c6074d8..b0b4a543cd 100644 --- a/apps/web/src/app/components/user-verification/user-verification.component.html +++ b/apps/web/src/app/components/user-verification/user-verification.component.html @@ -1,46 +1,41 @@ - - - {{ "confirmIdentity" | i18n }} + + {{ "masterPass" | i18n }} + + {{ "confirmIdentity" | i18n }} + -
- - - + {{ "codeSent" | i18n }}
-
- + + {{ "verificationCode" | i18n }} - {{ "confirmIdentity" | i18n }} -
+ {{ "confirmIdentity" | i18n }} +
diff --git a/libs/angular/src/auth/components/user-verification.component.ts b/libs/angular/src/auth/components/user-verification.component.ts index ea514e177c..63ddd0e9bc 100644 --- a/libs/angular/src/auth/components/user-verification.component.ts +++ b/libs/angular/src/auth/components/user-verification.component.ts @@ -1,5 +1,5 @@ import { Directive, OnInit } from "@angular/core"; -import { ControlValueAccessor, FormControl } from "@angular/forms"; +import { ControlValueAccessor, FormControl, Validators } from "@angular/forms"; import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction"; import { KeyConnectorService } from "@bitwarden/common/auth/abstractions/key-connector.service"; @@ -22,7 +22,7 @@ export class UserVerificationComponent implements ControlValueAccessor, OnInit { disableRequestOTP = false; sentCode = false; - secret = new FormControl(""); + secret = new FormControl("", [Validators.required]); private onChange: (value: Verification) => void; @@ -39,7 +39,7 @@ export class UserVerificationComponent implements ControlValueAccessor, OnInit { this.secret.valueChanges.subscribe((secret: string) => this.processChanges(secret)); } - async requestOTP() { + requestOTP = async () => { if (this.usesKeyConnector) { this.disableRequestOTP = true; try { @@ -49,7 +49,7 @@ export class UserVerificationComponent implements ControlValueAccessor, OnInit { this.disableRequestOTP = false; } } - } + }; writeValue(obj: any): void { this.secret.setValue(obj);