mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-28 17:27:50 +01:00
[bug] Add defaults for vault timeout (#1365)
* [bug] Add state defaults for vault timeout * [chore] Update jslib
This commit is contained in:
parent
d0e661b84b
commit
d066e0586a
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit d68c1dafaf0528f5323dd595773b0fa122403d0d
|
||||
Subproject commit e4cd0af2f9ae924f9b749fefe3695f7c69135bf6
|
@ -5,6 +5,7 @@ import { BroadcasterMessagingService } from "../../services/broadcasterMessaging
|
||||
import { HtmlStorageService } from "../../services/htmlStorage.service";
|
||||
import { I18nService } from "../../services/i18n.service";
|
||||
import { MemoryStorageService } from "../../services/memoryStorage.service";
|
||||
import { StateService } from "../../services/state.service";
|
||||
import { WebPlatformUtilsService } from "../../services/webPlatformUtils.service";
|
||||
|
||||
import { EventService } from "./event.service";
|
||||
@ -43,6 +44,7 @@ import { MessagingService as MessagingServiceAbstraction } from "jslib-common/ab
|
||||
import { NotificationsService as NotificationsServiceAbstraction } from "jslib-common/abstractions/notifications.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 { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
@ -172,6 +174,16 @@ export function initFactory(
|
||||
StateServiceAbstraction,
|
||||
],
|
||||
},
|
||||
{
|
||||
provide: StateServiceAbstraction,
|
||||
useClass: StateService,
|
||||
deps: [
|
||||
StorageServiceAbstraction,
|
||||
"SECURE_STORAGE",
|
||||
LogService,
|
||||
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 = process.env.NODE_ENV === "development" ? null : 15;
|
||||
}
|
||||
|
||||
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 web overides to default account values
|
||||
account = new Account(account);
|
||||
await super.addAccount(account);
|
||||
}
|
||||
}
|
@ -20,5 +20,5 @@
|
||||
"preserveWhitespaces": true
|
||||
},
|
||||
"files": ["src/app/polyfills.ts", "src/app/main.ts", "bitwarden_license/src/app/main.ts"],
|
||||
"include": ["src/connectors/*.ts"]
|
||||
"include": ["src/connectors/*.ts", "src/models/*.ts", "src/services/*.ts"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user