mirror of
https://github.com/bitwarden/desktop.git
synced 2024-10-31 08:10:29 +01:00
.
This commit is contained in:
parent
c659aa5285
commit
1e7a742660
@ -165,7 +165,7 @@ export class AppComponent implements OnInit {
|
|||||||
this.router.navigate(["login"]);
|
this.router.navigate(["login"]);
|
||||||
break;
|
break;
|
||||||
case "logout":
|
case "logout":
|
||||||
this.loading = true;
|
this.loading = message.userId == this.activeUserId;
|
||||||
await this.logOut(!!message.expired, message.userId);
|
await this.logOut(!!message.expired, message.userId);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
break;
|
break;
|
||||||
@ -451,28 +451,25 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async logOut(expired: boolean, userId?: string) {
|
private async logOut(expired: boolean, userId?: string) {
|
||||||
if (!userId) {
|
const userBeingLoggedOut = await this.stateService.getUserId({ userId: userId });
|
||||||
userId = await this.stateService.getUserId();
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.eventService.uploadEvents(userId),
|
this.eventService.uploadEvents(userBeingLoggedOut),
|
||||||
this.syncService.setLastSync(new Date(0), userId),
|
this.syncService.setLastSync(new Date(0), userBeingLoggedOut),
|
||||||
this.tokenService.clearToken(userId),
|
this.tokenService.clearToken(userBeingLoggedOut),
|
||||||
this.cryptoService.clearKeys(userId),
|
this.cryptoService.clearKeys(userBeingLoggedOut),
|
||||||
this.settingsService.clear(userId),
|
this.settingsService.clear(userBeingLoggedOut),
|
||||||
this.cipherService.clear(userId),
|
this.cipherService.clear(userBeingLoggedOut),
|
||||||
this.folderService.clear(userId),
|
this.folderService.clear(userBeingLoggedOut),
|
||||||
this.collectionService.clear(userId),
|
this.collectionService.clear(userBeingLoggedOut),
|
||||||
this.passwordGenerationService.clear(userId),
|
this.passwordGenerationService.clear(userBeingLoggedOut),
|
||||||
this.vaultTimeoutService.clear(userId),
|
this.vaultTimeoutService.clear(userBeingLoggedOut),
|
||||||
this.policyService.clear(userId),
|
this.policyService.clear(userBeingLoggedOut),
|
||||||
this.keyConnectorService.clear(),
|
this.keyConnectorService.clear(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await this.stateService.setBiometricLocked(true, { userId: userId });
|
await this.stateService.setBiometricLocked(true, { userId: userBeingLoggedOut });
|
||||||
|
|
||||||
if (userId == null || userId === (await this.stateService.getUserId())) {
|
if (userBeingLoggedOut === this.activeUserId) {
|
||||||
this.searchService.clearIndex();
|
this.searchService.clearIndex();
|
||||||
this.authService.logOut(async () => {
|
this.authService.logOut(async () => {
|
||||||
if (expired) {
|
if (expired) {
|
||||||
@ -485,11 +482,12 @@ export class AppComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.stateService.clean({ userId: userId });
|
const preLogoutActiveUserId = this.activeUserId;
|
||||||
|
await this.stateService.clean({ userId: userBeingLoggedOut });
|
||||||
|
|
||||||
if (this.stateService.activeAccount.getValue() == null) {
|
if (this.activeUserId == null) {
|
||||||
this.router.navigate(["login"]);
|
this.router.navigate(["login"]);
|
||||||
} else {
|
} else if (preLogoutActiveUserId != this.activeUserId) {
|
||||||
this.messagingService.send("switchAccount");
|
this.messagingService.send("switchAccount");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user