support for username gen website setting (#738)

This commit is contained in:
Kyle Spearrin 2022-03-25 05:32:01 -04:00 committed by GitHub
parent 81607e810e
commit fa73c13b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,7 @@ export class PasswordGeneratorComponent implements OnInit {
avoidAmbiguous = false;
showWebsiteOption = false;
enforcedPasswordPolicyOptions: PasswordGeneratorPolicyOptions;
usernameWebsite: string = null;
constructor(
protected passwordGenerationService: PasswordGenerationService,
@ -95,6 +96,9 @@ export class PasswordGeneratorComponent implements OnInit {
if (!this.showWebsiteOption) {
this.usernameOptions.subaddressType = this.usernameOptions.catchallType = "random";
}
if (this.usernameWebsite != null) {
this.usernameOptions.website = this.usernameWebsite;
}
if (qParams.type === "username" || qParams.type === "password") {
this.type = qParams.type;

View File

@ -36,6 +36,7 @@ import { TokenService as TokenServiceAbstraction } from "jslib-common/abstractio
import { TotpService as TotpServiceAbstraction } from "jslib-common/abstractions/totp.service";
import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service";
import { UserVerificationService as UserVerificationServiceAbstraction } from "jslib-common/abstractions/userVerification.service";
import { UsernameGenerationService as UsernameGenerationServiceAbstraction } from "jslib-common/abstractions/usernameGeneration.service";
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "jslib-common/abstractions/vaultTimeout.service";
import { StateFactory } from "jslib-common/factories/stateFactory";
import { Account } from "jslib-common/models/domain/account";
@ -69,6 +70,7 @@ import { TokenService } from "jslib-common/services/token.service";
import { TotpService } from "jslib-common/services/totp.service";
import { TwoFactorService } from "jslib-common/services/twoFactor.service";
import { UserVerificationService } from "jslib-common/services/userVerification.service";
import { UsernameGenerationService } from "jslib-common/services/usernameGeneration.service";
import { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
import { WebCryptoFunctionService } from "jslib-common/services/webCryptoFunction.service";
@ -198,6 +200,11 @@ import { ValidationService } from "./validation.service";
useClass: PasswordGenerationService,
deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction],
},
{
provide: UsernameGenerationServiceAbstraction,
useClass: UsernameGenerationService,
deps: [CryptoServiceAbstraction, StateServiceAbstraction],
},
{
provide: ApiServiceAbstraction,
useFactory: (