From 4b820bb7bdff4080f9d4edc3c024e61229faf324 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 5 Dec 2017 10:58:40 -0500 Subject: [PATCH] set default options for password generator --- src/services/passwordGeneration.service.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/services/passwordGeneration.service.ts b/src/services/passwordGeneration.service.ts index d8a10fbf48..77d4dda16e 100644 --- a/src/services/passwordGeneration.service.ts +++ b/src/services/passwordGeneration.service.ts @@ -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) {