From 82a83ead9803939a59fb26278b6a9571a76c47f4 Mon Sep 17 00:00:00 2001 From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com> Date: Wed, 22 May 2024 19:53:53 +0530 Subject: [PATCH] change kdf confirmation component migration (#8489) Change kdf configuration component migration --- .../change-kdf-confirmation.component.html | 81 ++++++++----------- .../change-kdf-confirmation.component.ts | 34 +++----- 2 files changed, 43 insertions(+), 72 deletions(-) diff --git a/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.html b/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.html index 8846104278..9f21b28f19 100644 --- a/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.html +++ b/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.html @@ -1,50 +1,33 @@ - - - {{ "changeKdf" | i18n }} - +
+ + + {{ "changeKdf" | i18n }} + - - {{ "kdfSettingsChangeLogoutWarning" | i18n }} - -
-
- {{ "masterPass" | i18n }} - - - {{ "confirmIdentity" | i18n }} - -
-
- -
- - - - -
+ + {{ "kdfSettingsChangeLogoutWarning" | i18n }} + + {{ "masterPass" | i18n }} + + + + {{ "confirmIdentity" | i18n }} + + + + + + +
+ diff --git a/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.ts b/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.ts index 1424310a33..6f57fb76ee 100644 --- a/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.ts +++ b/apps/web/src/app/auth/settings/security/change-kdf/change-kdf-confirmation.component.ts @@ -5,12 +5,10 @@ import { firstValueFrom, map } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service"; import { KdfConfig } from "@bitwarden/common/auth/models/domain/kdf-config"; import { KdfRequest } from "@bitwarden/common/models/request/kdf.request"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { KdfType } from "@bitwarden/common/platform/enums"; @@ -27,7 +25,6 @@ export class ChangeKdfConfirmationComponent { }); showPassword = false; masterPassword: string; - formPromise: Promise; loading = false; constructor( @@ -36,33 +33,24 @@ export class ChangeKdfConfirmationComponent { private platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService, private messagingService: MessagingService, + @Inject(DIALOG_DATA) params: { kdf: KdfType; kdfConfig: KdfConfig }, private accountService: AccountService, - private logService: LogService, - private kdfConfigService: KdfConfigService, - @Inject(DIALOG_DATA) params: { kdfConfig: KdfConfig }, ) { this.kdfConfig = params.kdfConfig; this.masterPassword = null; } - async submit() { + submit = async () => { this.loading = true; - - try { - this.formPromise = this.makeKeyAndSaveAsync(); - await this.formPromise; - this.platformUtilsService.showToast( - "success", - this.i18nService.t("encKeySettingsChanged"), - this.i18nService.t("logBackIn"), - ); - this.messagingService.send("logout"); - } catch (e) { - this.logService.error(e); - } finally { - this.loading = false; - } - } + await this.makeKeyAndSaveAsync(); + this.platformUtilsService.showToast( + "success", + this.i18nService.t("encKeySettingsChanged"), + this.i18nService.t("logBackIn"), + ); + this.messagingService.send("logout"); + this.loading = false; + }; private async makeKeyAndSaveAsync() { const masterPassword = this.form.value.masterPassword;