From 9b4f1045f38db7198c821723464dafdeb7a34316 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Fri, 28 Feb 2020 11:43:27 -0600 Subject: [PATCH] Enforce Password Generator Policy Options (#1155) --- src/background/commands.background.ts | 2 +- src/background/contextMenus.background.ts | 2 +- src/background/main.background.ts | 3 ++- .../generator/password-generator.component.html | 16 ++++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/background/commands.background.ts b/src/background/commands.background.ts index b844d8ea29..7a6b2adc32 100644 --- a/src/background/commands.background.ts +++ b/src/background/commands.background.ts @@ -57,7 +57,7 @@ export default class CommandsBackground { return; } - const options = await this.passwordGenerationService.getOptions(); + const options = (await this.passwordGenerationService.getOptions())[0]; const password = await this.passwordGenerationService.generatePassword(options); this.platformUtilsService.copyToClipboard(password, { window: window }); this.passwordGenerationService.addHistory(password); diff --git a/src/background/contextMenus.background.ts b/src/background/contextMenus.background.ts index d7f61dfcf8..c519f3a07a 100644 --- a/src/background/contextMenus.background.ts +++ b/src/background/contextMenus.background.ts @@ -37,7 +37,7 @@ export default class ContextMenusBackground { } private async generatePasswordToClipboard() { - const options = await this.passwordGenerationService.getOptions(); + const options = (await this.passwordGenerationService.getOptions())[0]; const password = await this.passwordGenerationService.generatePassword(options); this.platformUtilsService.copyToClipboard(password, { window: window }); this.passwordGenerationService.addHistory(password); diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 57a393cfbe..72a32dc6e2 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -175,7 +175,8 @@ export default class MainBackground { async (expired: boolean) => await this.logout(expired)); this.eventService = new EventService(this.storageService, this.apiService, this.userService, this.cipherService); - this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService); + this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService, + this.policyService); this.totpService = new TotpService(this.storageService, cryptoFunctionService); this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService, this.eventService); diff --git a/src/popup/generator/password-generator.component.html b/src/popup/generator/password-generator.component.html index ff51415ca7..ddf39bf888 100644 --- a/src/popup/generator/password-generator.component.html +++ b/src/popup/generator/password-generator.component.html @@ -78,19 +78,23 @@
- +
- +
- +
- +
@@ -98,12 +102,12 @@
-
-