1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

feat: clear cached history after successfull login

This commit is contained in:
Andreas Coroiu
2025-04-10 13:19:12 +02:00
parent a2cd3ecc1c
commit 4ede7f9056
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { DefaultLoginSuccessHandlerService } from "@bitwarden/auth/common";
import { SyncService } from "@bitwarden/common/platform/sync";
import { UserId } from "@bitwarden/common/types/guid";
import { UserAsymmetricKeysRegenerationService } from "@bitwarden/key-management";
import { PopupRouterCacheService } from "../../platform/popup/view-cache/popup-router-cache.service";
export class PopupLoginSuccessHandlerService extends DefaultLoginSuccessHandlerService {
constructor(
syncService: SyncService,
userAsymmetricKeysRegenerationService: UserAsymmetricKeysRegenerationService,
private popupRouterCacheService: PopupRouterCacheService,
) {
super(syncService, userAsymmetricKeysRegenerationService);
}
async run(userId: UserId): Promise<void> {
await this.popupRouterCacheService.setHistory([]);
await super.run(userId);
}
}

View File

@@ -35,6 +35,7 @@ import {
import { import {
LockService, LockService,
LoginEmailService, LoginEmailService,
LoginSuccessHandlerService,
PinServiceAbstraction, PinServiceAbstraction,
SsoUrlService, SsoUrlService,
} from "@bitwarden/auth/common"; } from "@bitwarden/auth/common";
@@ -129,6 +130,7 @@ import {
DefaultKeyService, DefaultKeyService,
KdfConfigService, KdfConfigService,
KeyService, KeyService,
UserAsymmetricKeysRegenerationService,
} from "@bitwarden/key-management"; } from "@bitwarden/key-management";
import { LockComponentService } from "@bitwarden/key-management-ui"; import { LockComponentService } from "@bitwarden/key-management-ui";
import { import {
@@ -146,6 +148,7 @@ import { ExtensionTwoFactorAuthComponentService } from "../../auth/services/exte
import { ExtensionTwoFactorAuthDuoComponentService } from "../../auth/services/extension-two-factor-auth-duo-component.service"; import { ExtensionTwoFactorAuthDuoComponentService } from "../../auth/services/extension-two-factor-auth-duo-component.service";
import { ExtensionTwoFactorAuthEmailComponentService } from "../../auth/services/extension-two-factor-auth-email-component.service"; import { ExtensionTwoFactorAuthEmailComponentService } from "../../auth/services/extension-two-factor-auth-email-component.service";
import { ExtensionTwoFactorAuthWebAuthnComponentService } from "../../auth/services/extension-two-factor-auth-webauthn-component.service"; import { ExtensionTwoFactorAuthWebAuthnComponentService } from "../../auth/services/extension-two-factor-auth-webauthn-component.service";
import { PopupLoginSuccessHandlerService } from "../../auth/services/popup-login-success-handler.service";
import { AutofillService as AutofillServiceAbstraction } from "../../autofill/services/abstractions/autofill.service"; import { AutofillService as AutofillServiceAbstraction } from "../../autofill/services/abstractions/autofill.service";
import AutofillService from "../../autofill/services/autofill.service"; import AutofillService from "../../autofill/services/autofill.service";
import { InlineMenuFieldQualificationService } from "../../autofill/services/inline-menu-field-qualification.service"; import { InlineMenuFieldQualificationService } from "../../autofill/services/inline-menu-field-qualification.service";
@@ -163,6 +166,7 @@ import { OffscreenDocumentService } from "../../platform/offscreen-document/abst
import { DefaultOffscreenDocumentService } from "../../platform/offscreen-document/offscreen-document.service"; import { DefaultOffscreenDocumentService } from "../../platform/offscreen-document/offscreen-document.service";
import { PopupCompactModeService } from "../../platform/popup/layout/popup-compact-mode.service"; import { PopupCompactModeService } from "../../platform/popup/layout/popup-compact-mode.service";
import { BrowserFileDownloadService } from "../../platform/popup/services/browser-file-download.service"; import { BrowserFileDownloadService } from "../../platform/popup/services/browser-file-download.service";
import { PopupRouterCacheService } from "../../platform/popup/view-cache/popup-router-cache.service";
import { PopupViewCacheService } from "../../platform/popup/view-cache/popup-view-cache.service"; import { PopupViewCacheService } from "../../platform/popup/view-cache/popup-view-cache.service";
import { ScriptInjectorService } from "../../platform/services/abstractions/script-injector.service"; import { ScriptInjectorService } from "../../platform/services/abstractions/script-injector.service";
import { BrowserEnvironmentService } from "../../platform/services/browser-environment.service"; import { BrowserEnvironmentService } from "../../platform/services/browser-environment.service";
@@ -667,6 +671,11 @@ const safeProviders: SafeProvider[] = [
useClass: ForegroundNotificationsService, useClass: ForegroundNotificationsService,
deps: [LogService], deps: [LogService],
}), }),
safeProvider({
provide: LoginSuccessHandlerService,
useClass: PopupLoginSuccessHandlerService,
deps: [SyncService, UserAsymmetricKeysRegenerationService, PopupRouterCacheService],
}),
]; ];
@NgModule({ @NgModule({