mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
fix clear when account unavailable error (#9299)
* fix clear when account unavailable error * remove explicit password history clear on logout
This commit is contained in:
parent
91ccb5ff93
commit
6ca836f31d
@ -1321,7 +1321,6 @@ export default class MainBackground {
|
||||
this.cipherService.clear(userBeingLoggedOut),
|
||||
this.folderService.clear(userBeingLoggedOut),
|
||||
this.collectionService.clear(userBeingLoggedOut),
|
||||
this.passwordGenerationService.clear(userBeingLoggedOut),
|
||||
this.vaultTimeoutSettingsService.clear(userBeingLoggedOut),
|
||||
this.vaultFilterService.clear(),
|
||||
this.biometricStateService.logout(userBeingLoggedOut),
|
||||
|
@ -740,7 +740,6 @@ export class ServiceContainer {
|
||||
this.cipherService.clear(userId),
|
||||
this.folderService.clear(userId),
|
||||
this.collectionService.clear(userId as UserId),
|
||||
this.passwordGenerationService.clear(),
|
||||
]);
|
||||
|
||||
await this.stateEventRunnerService.handleEvent("logout", userId);
|
||||
|
@ -608,7 +608,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
await this.cipherService.clear(userBeingLoggedOut);
|
||||
await this.folderService.clear(userBeingLoggedOut);
|
||||
await this.collectionService.clear(userBeingLoggedOut);
|
||||
await this.passwordGenerationService.clear(userBeingLoggedOut);
|
||||
await this.vaultTimeoutSettingsService.clear(userBeingLoggedOut);
|
||||
await this.biometricStateService.logout(userBeingLoggedOut);
|
||||
|
||||
|
@ -300,7 +300,6 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
this.cipherService.clear(userId),
|
||||
this.folderService.clear(userId),
|
||||
this.collectionService.clear(userId),
|
||||
this.passwordGenerationService.clear(),
|
||||
this.biometricStateService.logout(userId),
|
||||
this.paymentMethodWarningService.clear(),
|
||||
]);
|
||||
|
@ -8,6 +8,8 @@ import {
|
||||
of,
|
||||
concat,
|
||||
Observable,
|
||||
filter,
|
||||
timeout,
|
||||
} from "rxjs";
|
||||
|
||||
import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction";
|
||||
@ -382,6 +384,13 @@ export class LegacyPasswordGenerationService implements PasswordGenerationServic
|
||||
getHistory() {
|
||||
const history = this.accountService.activeAccount$.pipe(
|
||||
concatMap((account) => this.history.credentials$(account.id)),
|
||||
timeout({
|
||||
// timeout after 1 second
|
||||
each: 1000,
|
||||
with() {
|
||||
return [];
|
||||
},
|
||||
}),
|
||||
map((history) => history.map(toGeneratedPasswordHistory)),
|
||||
);
|
||||
|
||||
@ -390,13 +399,23 @@ export class LegacyPasswordGenerationService implements PasswordGenerationServic
|
||||
|
||||
async addHistory(password: string) {
|
||||
const account = await firstValueFrom(this.accountService.activeAccount$);
|
||||
if (account?.id) {
|
||||
// legacy service doesn't distinguish credential types
|
||||
await this.history.track(account.id, password, "password");
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
const history$ = this.accountService.activeAccount$.pipe(
|
||||
filter((account) => !!account?.id),
|
||||
concatMap((account) => this.history.clear(account.id)),
|
||||
timeout({
|
||||
// timeout after 1 second
|
||||
each: 1000,
|
||||
with() {
|
||||
return [];
|
||||
},
|
||||
}),
|
||||
map((history) => history.map(toGeneratedPasswordHistory)),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user