1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

enforce policies on generate command (#115)

This commit is contained in:
Kyle Spearrin 2020-03-03 16:29:10 -05:00 committed by GitHub
parent 3c2c1e69c5
commit ef602ff6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit 3d2e2cb1741be8b7b2916574f62f7ba2193c7123
Subproject commit 44b86f5dd028271059b70a00d7878fbb1a06023f

View File

@ -119,7 +119,8 @@ export class Main {
this.folderService, this.cipherService, this.cryptoService, this.collectionService,
this.storageService, this.messagingService, this.policyService,
async (expired: boolean) => await this.logout());
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService,
this.policyService);
this.totpService = new TotpService(this.storageService, this.cryptoFunctionService);
this.importService = new ImportService(this.cipherService, this.folderService, this.apiService,
this.i18nService, this.collectionService);

View File

@ -35,7 +35,8 @@ export class GenerateCommand {
} else if (options.wordSeparator != null && options.wordSeparator.length > 1) {
options.wordSeparator = options.wordSeparator[0];
}
const password = await this.passwordGenerationService.generatePassword(options);
const enforcedOptions = await this.passwordGenerationService.enforcePasswordGeneratorPoliciesOnOptions(options);
const password = await this.passwordGenerationService.generatePassword(enforcedOptions[0]);
const res = new StringResponse(password);
return Response.success(res);
}