1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

[PM-2135] feat: refactor user-verification component

This commit is contained in:
Andreas Coroiu
2023-05-05 10:33:39 +02:00
parent b287ab3398
commit 5ccf5584b8
2 changed files with 27 additions and 32 deletions

View File

@@ -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);