From b762e3a3d9fa5abef30017752a945def902a6082 Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Fri, 5 Nov 2021 13:43:19 -0400 Subject: [PATCH] Fix account getting set to null in getAccountFromDisk --- common/src/services/state.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 187098c7..28986c00 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -43,15 +43,15 @@ export class StateService implements StateServiceAbstraction { } private get defaultOnDiskOptions(): StorageOptions { - return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Session, userId: this.state.activeUserId }; + return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Session, userId: this.state.activeUserId, useSecureStorage: true }; } private get defaultOnDiskLocalOptions(): StorageOptions { - return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Local, userId: this.state.activeUserId }; + return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Local, userId: this.state.activeUserId, useSecureStorage: true }; } private get defaultOnDiskMemoryOptions(): StorageOptions { - return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Memory, userId: this.state.activeUserId }; + return { storageLocation: StorageLocation.Disk, htmlStorageLocation: HtmlStorageLocation.Memory, userId: this.state.activeUserId, useSecureStorage: true }; } private get defaultSecureStorageOptions(): StorageOptions { @@ -69,7 +69,7 @@ export class StateService implements StateServiceAbstraction { } async getEnableGravitars(options?: StorageOptions): Promise { - return (await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskLocalOptions))).enableGravitars ?? true; + return (await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskLocalOptions)))?.enableGravitars ?? true; } async getAddEditCipherInfo(options?: StorageOptions): Promise { @@ -1291,7 +1291,7 @@ export class StateService implements StateServiceAbstraction { } private async saveAccountToMemory(account: Account): Promise { - if (this.getAccountFromMemory({userId: account.userId}) !== null) { + if (this.getAccountFromMemory({ userId: account.userId }) !== null) { this.state.accounts[account.userId] = account; } await this.pushAccounts(); @@ -1317,7 +1317,7 @@ export class StateService implements StateServiceAbstraction { } for (const i in this.state.accounts) { - if (this.state.accounts[i].userId === this.state.activeUserId ) { + if (this.state.accounts[i].userId === this.state.activeUserId) { this.state.accounts[i].authenticationStatus = AuthenticationStatus.Active; } else { const vaultTimeout = await this.getVaultTimeout({