1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

[Auto-Logout] Implement upstream changes (#506)

* Initial commit of auto logout functionality

* Update jslib 31a2574 -> 28e3fff

* Reverting prod URLs

* Set log out expired param to false

Co-authored-by: Vincent Salucci <vsalucci@bitwarden.com>
This commit is contained in:
Vincent Salucci
2020-03-30 09:59:47 -05:00
committed by GitHub
parent 5bf3ca2708
commit d58550c2b8
9 changed files with 81 additions and 38 deletions

View File

@@ -4,16 +4,24 @@ import { ConstantsService } from 'jslib/services';
export class HtmlStorageService implements StorageService {
private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions',
ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail', 'enableGravatars',
ConstantsService.localeKey, ConstantsService.lockOptionKey, ConstantsService.autoConfirmFingerprints]);
ConstantsService.disableFaviconKey, 'rememberEmail', 'enableGravatars', ConstantsService.localeKey,
ConstantsService.autoConfirmFingerprints, ConstantsService.vaultTimeoutKey,
ConstantsService.vaultTimeoutActionKey]);
private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_'];
constructor(private platformUtilsService: PlatformUtilsService) { }
async init() {
const lockOption = await this.get<number>(ConstantsService.lockOptionKey);
if (lockOption == null && !this.platformUtilsService.isDev()) {
await this.save(ConstantsService.lockOptionKey, 15);
// LockOption -> VaultTimeout (uses the same legacy string value for backwards compat)
const vaultTimeout = await this.get<number>(ConstantsService.vaultTimeoutKey);
if (vaultTimeout == null && !this.platformUtilsService.isDev()) {
await this.save(ConstantsService.vaultTimeoutKey, 15);
}
// Default Action to lock
const vaultTimeoutAction = await this.get<string>(ConstantsService.vaultTimeoutActionKey);
if (vaultTimeoutAction == null) {
await this.save(ConstantsService.vaultTimeoutActionKey, 'lock');
}
}