From b262d11db1d37cb189a7eb9fa48e1b5372ae3585 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:43:55 -0700 Subject: [PATCH] remove comments --- .../password-settings.component.ts | 1 - apps/web/src/app/core/core.module.ts | 2 -- libs/angular/src/services/jslib-services.module.ts | 2 -- .../change-password/change-password.component.ts | 12 +----------- .../input-password/input-password.component.ts | 6 ++---- .../default-change-password.service.ts | 14 -------------- 6 files changed, 3 insertions(+), 34 deletions(-) diff --git a/apps/web/src/app/auth/settings/security/password-settings/password-settings.component.ts b/apps/web/src/app/auth/settings/security/password-settings/password-settings.component.ts index ca4c988bc80..25fc8f1c6b5 100644 --- a/apps/web/src/app/auth/settings/security/password-settings/password-settings.component.ts +++ b/apps/web/src/app/auth/settings/security/password-settings/password-settings.component.ts @@ -24,7 +24,6 @@ export class PasswordSettingsComponent implements OnInit { ) {} async ngOnInit() { - // TODO-rr-bw: test that no MP = get routed to settings/security/two-factor const userHasMasterPassword = await firstValueFrom( this.userDecryptionOptionsService.hasMasterPassword$, ); diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index 8d4e41f8d94..bf63baab14d 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -390,11 +390,9 @@ const safeProviders: SafeProvider[] = [ useClass: WebChangePasswordService, deps: [ AccountService, - I18nServiceAbstraction, KeyServiceAbstraction, MasterPasswordApiServiceAbstraction, InternalMasterPasswordServiceAbstraction, - ToastService, ], }), ]; diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 7100b6ad10e..0aca9f65bf2 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -1512,11 +1512,9 @@ const safeProviders: SafeProvider[] = [ useClass: DefaultChangePasswordService, deps: [ AccountServiceAbstraction, - I18nServiceAbstraction, KeyService, MasterPasswordApiServiceAbstraction, InternalMasterPasswordServiceAbstraction, - ToastService, ], }), ]; diff --git a/libs/auth/src/angular/change-password/change-password.component.ts b/libs/auth/src/angular/change-password/change-password.component.ts index a8c12ce83c6..04ed4ffc51f 100644 --- a/libs/auth/src/angular/change-password/change-password.component.ts +++ b/libs/auth/src/angular/change-password/change-password.component.ts @@ -101,7 +101,7 @@ export class ChangePasswordComponent implements OnInit { message: this.i18nService.t("masterPasswordChangedDesc"), }); - this.messagingService.send("logout"); // TODO-rr-bw: verify + this.messagingService.send("logout"); } } catch (e) { this.toastService.showToast({ @@ -128,16 +128,6 @@ export class ChangePasswordComponent implements OnInit { throw new Error("Could not decrypt user key"); } - // TODO-rr-bw: do we still need this check/toast if it is handled in InputPasswordComponent? - if (decryptedUserKey == null) { - this.toastService.showToast({ - variant: "error", - title: null, - message: this.i18nService.t("invalidMasterPassword"), - }); - return; - } - const newMasterKeyEncryptedUserKey = await this.keyService.encryptUserKeyWithMasterKey( passwordInputResult.newMasterKey, decryptedUserKey, diff --git a/libs/auth/src/angular/input-password/input-password.component.ts b/libs/auth/src/angular/input-password/input-password.component.ts index bb548219fab..c9c932a9d3a 100644 --- a/libs/auth/src/angular/input-password/input-password.component.ts +++ b/libs/auth/src/angular/input-password/input-password.component.ts @@ -108,7 +108,7 @@ export class InputPasswordComponent implements OnInit { protected secondaryButtonTextStr: string = ""; protected InputPasswordFlow = InputPasswordFlow; - private kdfConfig: KdfConfig = DEFAULT_KDF_CONFIG; // TODO-rr-bw: verify + private kdfConfig: KdfConfig = DEFAULT_KDF_CONFIG; private minHintLength = 0; protected maxHintLength = 50; protected minPasswordLength = Utils.minimumPasswordLength; @@ -222,7 +222,7 @@ export class InputPasswordComponent implements OnInit { throw new Error("Email is required to create master key."); } - this.kdfConfig = (await this.kdfConfigService.getKdfConfig()) || DEFAULT_KDF_CONFIG; // TODO-rr-bw: confirm this + this.kdfConfig = (await this.kdfConfigService.getKdfConfig()) || DEFAULT_KDF_CONFIG; const currentPassword = this.formGroup.get("currentPassword")?.value; const { newPassword, newPasswordHint, checkForBreaches } = this.formGroup.value; @@ -445,7 +445,6 @@ export class InputPasswordComponent implements OnInit { ); } - // TODO-rr-bw: verify (this.formGroup.get("rotateUserKey") as unknown as FormControl)?.setValue(false); return; } @@ -462,7 +461,6 @@ export class InputPasswordComponent implements OnInit { }); if (!result) { - // TODO-rr-bw: verify (this.formGroup.get("rotateUserKey") as unknown as FormControl)?.setValue(false); } } diff --git a/libs/auth/src/common/services/change-password/default-change-password.service.ts b/libs/auth/src/common/services/change-password/default-change-password.service.ts index dbb50815612..85aa40db7a7 100644 --- a/libs/auth/src/common/services/change-password/default-change-password.service.ts +++ b/libs/auth/src/common/services/change-password/default-change-password.service.ts @@ -5,9 +5,7 @@ import { MasterPasswordApiService } from "@bitwarden/common/auth/abstractions/ma import { PasswordRequest } from "@bitwarden/common/auth/models/request/password.request"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { MasterKey } from "@bitwarden/common/types/key"; -import { ToastService } from "@bitwarden/components"; import { KeyService } from "@bitwarden/key-management"; import { ChangePasswordService } from "../../abstractions"; @@ -15,11 +13,9 @@ import { ChangePasswordService } from "../../abstractions"; export class DefaultChangePasswordService implements ChangePasswordService { constructor( private accountService: AccountService, - private i18nService: I18nService, private keyService: KeyService, private masterPasswordApiService: MasterPasswordApiService, private masterPasswordService: InternalMasterPasswordServiceAbstraction, - private toastService: ToastService, ) {} async rotateUserKeyMasterPasswordAndEncryptedData( @@ -56,16 +52,6 @@ export class DefaultChangePasswordService implements ChangePasswordService { throw new Error("Could not decrypt user key"); } - // TODO-rr-bw: do we still need this check/toast if it is handled in InputPasswordComponent? - if (decryptedUserKey == null) { - this.toastService.showToast({ - variant: "error", - title: null, - message: this.i18nService.t("invalidMasterPassword"), - }); - return; - } - const newMasterKeyEncryptedUserKey = await this.keyService.encryptUserKeyWithMasterKey( newMasterKey, decryptedUserKey,