mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
[Bug] VaultTimeout incorrectly defaults to "Never" (#1230)
* [Bug] VaultTimeout incorrectly defaults to "Never" The default desktop vault timeout value is "On Restart", but there is no default set for this in the state service and account model. This commit extends the StateService and Account model to consider the special vault timeout default requirements needed for desktop. * [style] Lint fixes * [chore] Update jslib
This commit is contained in:
parent
71c2fee574
commit
653ff8f45f
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit 172392ff3b3d8e68795549deef5433c0d1329c9c
|
||||
Subproject commit 957e010036c89cfbcb0b526eea99c4b9e292b1f8
|
@ -10,6 +10,8 @@ import { I18nService } from "../services/i18n.service";
|
||||
import { LoginGuardService } from "../services/loginGuard.service";
|
||||
import { NativeMessagingService } from "../services/nativeMessaging.service";
|
||||
import { PasswordRepromptService } from "../services/passwordReprompt.service";
|
||||
import { StateService } from "../services/state.service";
|
||||
|
||||
import { SearchBarService } from "./layout/search/search-bar.service";
|
||||
|
||||
import { JslibServicesModule } from "jslib-angular/services/jslib-services.module";
|
||||
@ -35,6 +37,7 @@ import { NotificationsService as NotificationsServiceAbstraction } from "jslib-c
|
||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "jslib-common/abstractions/passwordReprompt.service";
|
||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service";
|
||||
import { StateMigrationService as StateMigrationServiceAbstraction } from "jslib-common/abstractions/stateMigration.service";
|
||||
import { StorageService as StorageServiceAbstraction } from "jslib-common/abstractions/storage.service";
|
||||
import { SyncService as SyncServiceAbstraction } from "jslib-common/abstractions/sync.service";
|
||||
import { SystemService as SystemServiceAbstraction } from "jslib-common/abstractions/system.service";
|
||||
@ -168,6 +171,16 @@ export function initFactory(
|
||||
useClass: LoginGuardService,
|
||||
deps: [StateServiceAbstraction, PlatformUtilsServiceAbstraction, I18nServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: StateServiceAbstraction,
|
||||
useClass: StateService,
|
||||
deps: [
|
||||
StorageServiceAbstraction,
|
||||
"SECURE_STORAGE",
|
||||
LogServiceAbstraction,
|
||||
StateMigrationServiceAbstraction,
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class ServicesModule {}
|
||||
|
20
src/models/account.ts
Normal file
20
src/models/account.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import {
|
||||
Account as BaseAccount,
|
||||
AccountSettings as BaseAccountSettings,
|
||||
} from "jslib-common/models/domain/account";
|
||||
|
||||
export class AccountSettings extends BaseAccountSettings {
|
||||
vaultTimeout: number = -1; // On Restart
|
||||
}
|
||||
|
||||
export class Account extends BaseAccount {
|
||||
settings?: AccountSettings = new AccountSettings();
|
||||
|
||||
constructor(init: Partial<Account>) {
|
||||
super(init);
|
||||
Object.assign(this.settings, {
|
||||
...new AccountSettings(),
|
||||
...this.settings,
|
||||
});
|
||||
}
|
||||
}
|
13
src/services/state.service.ts
Normal file
13
src/services/state.service.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { StateService as BaseStateService } from "jslib-common/services/state.service";
|
||||
|
||||
import { Account } from "../models/account";
|
||||
|
||||
import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service";
|
||||
|
||||
export class StateService extends BaseStateService<Account> implements StateServiceAbstraction {
|
||||
async addAccount(account: Account) {
|
||||
// Apply desktop overides to default account values
|
||||
account = new Account(account);
|
||||
await super.addAccount(account);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user