1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-02 04:48:57 +02:00

set default options for password generator

This commit is contained in:
Kyle Spearrin 2017-12-05 10:58:40 -05:00
parent 6cc78f5b9b
commit 4b820bb7bd

View File

@ -6,7 +6,7 @@ import CryptoService from './crypto.service';
import UtilsService from './utils.service'; import UtilsService from './utils.service';
const DefaultOptions = { const DefaultOptions = {
length: 10, length: 14,
ambiguous: false, ambiguous: false,
number: true, number: true,
minNumber: 1, minNumber: 1,
@ -161,13 +161,16 @@ export default class PasswordGenerationService {
} }
async getOptions() { async getOptions() {
if (this.optionsCache) { if (this.optionsCache == null) {
return this.optionsCache; let options = await UtilsService.getObjFromStorage(Keys.options);
if (options == null) {
this.optionsCache = DefaultOptions;
} else {
this.optionsCache = options;
}
} }
const options = await UtilsService.getObjFromStorage(Keys.options); return this.optionsCache;
this.optionsCache = options;
return options;
} }
async saveOptions(options: any) { async saveOptions(options: any) {