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
1 changed files with 9 additions and 6 deletions

View File

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