mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 17:13:47 +00:00
fix email 2fa validation (#9702)
This commit is contained in:
@@ -41,6 +41,7 @@ export abstract class TwoFactorBaseComponent {
|
||||
this.authed = true;
|
||||
}
|
||||
|
||||
/** @deprecated used for formPromise flows.*/
|
||||
protected async enable(enableFunction: () => Promise<void>) {
|
||||
try {
|
||||
await enableFunction();
|
||||
@@ -50,6 +51,10 @@ export abstract class TwoFactorBaseComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated used for formPromise flows.
|
||||
* TODO: Remove this method when formPromises are removed from all flows.
|
||||
* */
|
||||
protected async disable(promise: Promise<unknown>) {
|
||||
const confirmed = await this.dialogService.openSimpleDialog({
|
||||
title: { key: "disable" },
|
||||
@@ -78,6 +83,29 @@ export abstract class TwoFactorBaseComponent {
|
||||
}
|
||||
}
|
||||
|
||||
protected async disableMethod() {
|
||||
const confirmed = await this.dialogService.openSimpleDialog({
|
||||
title: { key: "disable" },
|
||||
content: { key: "twoStepDisableDesc" },
|
||||
type: "warning",
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const request = await this.buildRequestModel(TwoFactorProviderRequest);
|
||||
request.type = this.type;
|
||||
if (this.organizationId != null) {
|
||||
await this.apiService.putTwoFactorOrganizationDisable(this.organizationId, request);
|
||||
} else {
|
||||
await this.apiService.putTwoFactorDisable(request);
|
||||
}
|
||||
this.enabled = false;
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("twoStepDisabled"));
|
||||
this.onUpdated.emit(false);
|
||||
}
|
||||
|
||||
protected async buildRequestModel<T extends SecretVerificationRequest>(
|
||||
requestClass: new () => T,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user