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; avoidAmbiguous = false;
showWebsiteOption = false; showWebsiteOption = false;
enforcedPasswordPolicyOptions: PasswordGeneratorPolicyOptions; enforcedPasswordPolicyOptions: PasswordGeneratorPolicyOptions;
usernameWebsite: string = null;
constructor( constructor(
protected passwordGenerationService: PasswordGenerationService, protected passwordGenerationService: PasswordGenerationService,
@ -95,6 +96,9 @@ export class PasswordGeneratorComponent implements OnInit {
if (!this.showWebsiteOption) { if (!this.showWebsiteOption) {
this.usernameOptions.subaddressType = this.usernameOptions.catchallType = "random"; this.usernameOptions.subaddressType = this.usernameOptions.catchallType = "random";
} }
if (this.usernameWebsite != null) {
this.usernameOptions.website = this.usernameWebsite;
}
if (qParams.type === "username" || qParams.type === "password") { if (qParams.type === "username" || qParams.type === "password") {
this.type = qParams.type; 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 { TotpService as TotpServiceAbstraction } from "jslib-common/abstractions/totp.service";
import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service"; import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service";
import { UserVerificationService as UserVerificationServiceAbstraction } from "jslib-common/abstractions/userVerification.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 { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "jslib-common/abstractions/vaultTimeout.service";
import { StateFactory } from "jslib-common/factories/stateFactory"; import { StateFactory } from "jslib-common/factories/stateFactory";
import { Account } from "jslib-common/models/domain/account"; 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 { TotpService } from "jslib-common/services/totp.service";
import { TwoFactorService } from "jslib-common/services/twoFactor.service"; import { TwoFactorService } from "jslib-common/services/twoFactor.service";
import { UserVerificationService } from "jslib-common/services/userVerification.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 { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
import { WebCryptoFunctionService } from "jslib-common/services/webCryptoFunction.service"; import { WebCryptoFunctionService } from "jslib-common/services/webCryptoFunction.service";
@ -198,6 +200,11 @@ import { ValidationService } from "./validation.service";
useClass: PasswordGenerationService, useClass: PasswordGenerationService,
deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction], deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction],
}, },
{
provide: UsernameGenerationServiceAbstraction,
useClass: UsernameGenerationService,
deps: [CryptoServiceAbstraction, StateServiceAbstraction],
},
{ {
provide: ApiServiceAbstraction, provide: ApiServiceAbstraction,
useFactory: ( useFactory: (