From df8205f361de02152ed32f70262497174e8711db Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Thu, 24 Apr 2025 13:49:44 -0700 Subject: [PATCH] update DI of service --- .../change-password/web-change-password.service.ts | 14 +++++++++++--- apps/web/src/app/core/core.module.ts | 2 ++ .../default-change-password.service.ts | 6 +++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts b/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts index 85cd6ce8d15..886feb0badc 100644 --- a/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts +++ b/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts @@ -1,14 +1,22 @@ -import { inject } from "@angular/core"; - import { ChangePasswordService, DefaultChangePasswordService } from "@bitwarden/auth/angular"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; +import { MasterPasswordApiService } from "@bitwarden/common/auth/abstractions/master-password-api.service.abstraction"; +import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; +import { KeyService } from "@bitwarden/key-management"; import { UserKeyRotationService } from "@bitwarden/web-vault/app/key-management/key-rotation/user-key-rotation.service"; export class WebChangePasswordService extends DefaultChangePasswordService implements ChangePasswordService { - userKeyRotationService = inject(UserKeyRotationService); + constructor( + protected keyService: KeyService, + protected masterPasswordApiService: MasterPasswordApiService, + protected masterPasswordService: InternalMasterPasswordServiceAbstraction, + private userKeyRotationService: UserKeyRotationService, + ) { + super(keyService, masterPasswordApiService, masterPasswordService); + } override async rotateUserKeyMasterPasswordAndEncryptedData( currentPassword: string, diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index 10ed9858dac..192418799fe 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -126,6 +126,7 @@ import { AcceptOrganizationInviteService } from "../auth/organization-invite/acc import { HtmlStorageService } from "../core/html-storage.service"; import { I18nService } from "../core/i18n.service"; import { WebFileDownloadService } from "../core/web-file-download.service"; +import { UserKeyRotationService } from "../key-management/key-rotation/user-key-rotation.service"; import { WebLockComponentService } from "../key-management/lock/services/web-lock-component.service"; import { WebProcessReloadService } from "../key-management/services/web-process-reload.service"; import { WebBiometricsService } from "../key-management/web-biometric.service"; @@ -389,6 +390,7 @@ const safeProviders: SafeProvider[] = [ KeyServiceAbstraction, MasterPasswordApiService, InternalMasterPasswordServiceAbstraction, + UserKeyRotationService, ], }), ]; diff --git a/libs/auth/src/angular/change-password/default-change-password.service.ts b/libs/auth/src/angular/change-password/default-change-password.service.ts index 91d1719b691..cb5084f079c 100644 --- a/libs/auth/src/angular/change-password/default-change-password.service.ts +++ b/libs/auth/src/angular/change-password/default-change-password.service.ts @@ -8,9 +8,9 @@ import { KeyService } from "@bitwarden/key-management"; export class DefaultChangePasswordService implements ChangePasswordService { constructor( - private keyService: KeyService, - private masterPasswordApiService: MasterPasswordApiService, - private masterPasswordService: InternalMasterPasswordServiceAbstraction, + protected keyService: KeyService, + protected masterPasswordApiService: MasterPasswordApiService, + protected masterPasswordService: InternalMasterPasswordServiceAbstraction, ) {} async rotateUserKeyMasterPasswordAndEncryptedData(