1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[bug] Fix logout timeout action for inactive accounts (#660)

* [bug] Fix logout timeout action for inactive accounts

* Pass userId in to the logout callback parameter to the vaultTimeoutService. The message handle in desktop already expects this.
* Set lastActive on account login, and null it on account deauthentication. This prevents an issue where newly logged in accounts immediatly time out due to inactivity.

* Add userId to locked callbacks

* Add userId to log out callback
This commit is contained in:
Addison Beck
2022-02-09 12:15:20 -05:00
committed by GitHub
parent 8cb029947b
commit c282ef8575
3 changed files with 8 additions and 5 deletions

View File

@@ -121,6 +121,7 @@ export class StateService<
await this.storageService.save(keys.authenticatedAccounts, this.state.authenticatedAccounts);
this.state.accounts[account.profile.userId] = account;
await this.scaffoldNewAccountStorage(account);
await this.setLastActive(new Date().getTime(), { userId: account.profile.userId });
await this.setActiveUser(account.profile.userId);
this.activeAccount.next(account.profile.userId);
}
@@ -2437,6 +2438,7 @@ export class StateService<
protected async deAuthenticateAccount(userId: string) {
await this.setAccessToken(null, { userId: userId });
await this.setLastActive(null, { userId: userId });
const index = this.state.authenticatedAccounts.indexOf(userId);
if (index > -1) {
this.state.authenticatedAccounts.splice(index, 1);