1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-13 06:43:20 +00:00

[fix] Generator settings not persisting across web sessions (#824)

This commit is contained in:
Addison Beck
2022-06-06 08:56:56 -04:00
committed by addison
parent 1cc4bed671
commit 6f117b9901

View File

@@ -1769,52 +1769,52 @@ export class StateService<
async getPasswordGenerationOptions(options?: StorageOptions): Promise<any> { async getPasswordGenerationOptions(options?: StorageOptions): Promise<any> {
return ( return (
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions())) await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
)?.settings?.passwordGenerationOptions; )?.settings?.passwordGenerationOptions;
} }
async setPasswordGenerationOptions(value: any, options?: StorageOptions): Promise<void> { async setPasswordGenerationOptions(value: any, options?: StorageOptions): Promise<void> {
const account = await this.getAccount( const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
account.settings.passwordGenerationOptions = value; account.settings.passwordGenerationOptions = value;
await this.saveAccount( await this.saveAccount(
account, account,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
} }
async getUsernameGenerationOptions(options?: StorageOptions): Promise<any> { async getUsernameGenerationOptions(options?: StorageOptions): Promise<any> {
return ( return (
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions())) await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
)?.settings?.usernameGenerationOptions; )?.settings?.usernameGenerationOptions;
} }
async setUsernameGenerationOptions(value: any, options?: StorageOptions): Promise<void> { async setUsernameGenerationOptions(value: any, options?: StorageOptions): Promise<void> {
const account = await this.getAccount( const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
account.settings.usernameGenerationOptions = value; account.settings.usernameGenerationOptions = value;
await this.saveAccount( await this.saveAccount(
account, account,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
} }
async getGeneratorOptions(options?: StorageOptions): Promise<any> { async getGeneratorOptions(options?: StorageOptions): Promise<any> {
return ( return (
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions())) await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()))
)?.settings?.generatorOptions; )?.settings?.generatorOptions;
} }
async setGeneratorOptions(value: any, options?: StorageOptions): Promise<void> { async setGeneratorOptions(value: any, options?: StorageOptions): Promise<void> {
const account = await this.getAccount( const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
account.settings.generatorOptions = value; account.settings.generatorOptions = value;
await this.saveAccount( await this.saveAccount(
account, account,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
); );
} }