1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[bug] Default rememberEmail to true (#1429)

This commit is contained in:
Addison Beck
2022-02-02 11:20:15 -05:00
committed by GitHub
parent 8910430dfb
commit 8030da2ed5
7 changed files with 74 additions and 8 deletions

View File

@@ -1,13 +1,36 @@
import { StateService as BaseStateService } from "jslib-common/services/state.service";
import { Account } from "../models/account";
import { GlobalState } from "../models/globalState";
import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service";
import { StateService as StateServiceAbstraction } from "../abstractions/state.service";
export class StateService extends BaseStateService<Account> implements StateServiceAbstraction {
import { StorageOptions } from "jslib-common/models/domain/storageOptions";
export class StateService
extends BaseStateService<Account, GlobalState>
implements StateServiceAbstraction
{
async addAccount(account: Account) {
// Apply web overides to default account values
account = new Account(account);
await super.addAccount(account);
}
async getRememberEmail(options?: StorageOptions) {
return (
await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
)?.rememberEmail;
}
async setRememberEmail(value: boolean, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
);
globals.rememberEmail = value;
await this.saveGlobals(
globals,
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
);
}
}