From 0189401a069eab4af68a1081a13021833fe19fae Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Fri, 14 Oct 2022 18:52:55 -0300 Subject: [PATCH] EC-601 Remove device verification UI from web to avoid confusing users (#3744) --- .../settings/two-factor-setup.component.ts | 19 +------ .../settings/two-factor-setup.component.html | 34 ------------ .../settings/two-factor-setup.component.ts | 52 +------------------ 3 files changed, 3 insertions(+), 102 deletions(-) diff --git a/apps/web/src/app/organizations/settings/two-factor-setup.component.ts b/apps/web/src/app/organizations/settings/two-factor-setup.component.ts index be82b0a86b..b50adc3bb0 100644 --- a/apps/web/src/app/organizations/settings/two-factor-setup.component.ts +++ b/apps/web/src/app/organizations/settings/two-factor-setup.component.ts @@ -3,10 +3,7 @@ import { ActivatedRoute } from "@angular/router"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/abstractions/messaging.service"; -import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction"; import { StateService } from "@bitwarden/common/abstractions/state.service"; import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType"; @@ -26,21 +23,9 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { messagingService: MessagingService, policyService: PolicyService, private route: ActivatedRoute, - stateService: StateService, - platformUtilsService: PlatformUtilsService, - i18nService: I18nService, - logService: LogService + stateService: StateService ) { - super( - apiService, - modalService, - messagingService, - policyService, - stateService, - platformUtilsService, - i18nService, - logService - ); + super(apiService, modalService, messagingService, policyService, stateService); } async ngOnInit() { diff --git a/apps/web/src/app/settings/two-factor-setup.component.html b/apps/web/src/app/settings/two-factor-setup.component.html index b846fdb981..27fc2990e6 100644 --- a/apps/web/src/app/settings/two-factor-setup.component.html +++ b/apps/web/src/app/settings/two-factor-setup.component.html @@ -55,40 +55,6 @@ -
-
-
-

- {{ "deviceVerification" | i18n }} -

-
-
- - -
- {{ "deviceVerificationDesc" | i18n }} -
- -
-
-
diff --git a/apps/web/src/app/settings/two-factor-setup.component.ts b/apps/web/src/app/settings/two-factor-setup.component.ts index 994262548b..72daa52039 100644 --- a/apps/web/src/app/settings/two-factor-setup.component.ts +++ b/apps/web/src/app/settings/two-factor-setup.component.ts @@ -4,15 +4,11 @@ import { Subject, takeUntil } from "rxjs"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/abstractions/messaging.service"; -import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction"; import { StateService } from "@bitwarden/common/abstractions/state.service"; import { PolicyType } from "@bitwarden/common/enums/policyType"; import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType"; -import { DeviceVerificationRequest } from "@bitwarden/common/models/request/deviceVerificationRequest"; import { TwoFactorProviders } from "@bitwarden/common/services/twoFactor.service"; import { TwoFactorAuthenticatorComponent } from "./two-factor-authenticator.component"; @@ -44,8 +40,6 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { canAccessPremium: boolean; showPolicyWarning = false; loading = true; - enableDeviceVerification: boolean; - isDeviceVerificationSectionEnabled: boolean; modal: ModalRef; formPromise: Promise; @@ -57,22 +51,11 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { protected modalService: ModalService, protected messagingService: MessagingService, protected policyService: PolicyService, - private stateService: StateService, - private platformUtilsService: PlatformUtilsService, - private i18nService: I18nService, - private logService: LogService + private stateService: StateService ) {} async ngOnInit() { this.canAccessPremium = await this.stateService.getCanAccessPremium(); - try { - const deviceVerificationSettings = await this.apiService.getDeviceVerificationSettings(); - this.isDeviceVerificationSectionEnabled = - deviceVerificationSettings.isDeviceVerificationSectionEnabled; - this.enableDeviceVerification = deviceVerificationSettings.unknownDeviceVerificationEnabled; - } catch (e) { - this.logService.error(e); - } for (const key in TwoFactorProviders) { // eslint-disable-next-line @@ -224,37 +207,4 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { this.showPolicyWarning = false; } } - - async submit() { - try { - if (this.enableDeviceVerification) { - const email = await this.stateService.getEmail(); - const confirmed = await this.platformUtilsService.showDialog( - this.i18nService.t( - "areYouSureYouWantToEnableDeviceVerificationTheVerificationCodeEmailsWillArriveAtX", - email - ), - this.i18nService.t("deviceVerification"), - this.i18nService.t("yes"), - this.i18nService.t("no"), - "warning" - ); - if (!confirmed) { - return; - } - } - - this.formPromise = this.apiService.putDeviceVerificationSettings( - new DeviceVerificationRequest(this.enableDeviceVerification) - ); - await this.formPromise; - this.platformUtilsService.showToast( - "success", - null, - this.i18nService.t("updatedDeviceVerification") - ); - } catch (e) { - this.logService.error(e); - } - } }