1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 21:33:27 +00:00

check credential type explicitly when loading evaluator (#7791)

This commit is contained in:
✨ Audrey ✨
2024-02-09 11:33:52 -05:00
committed by GitHub
parent bb031f6779
commit 64381cbae0

View File

@@ -195,9 +195,10 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
options.type = policy.defaultType; options.type = policy.defaultType;
} }
const evaluator = options.type const evaluator =
? new PasswordGeneratorOptionsEvaluator(policy) options.type == "password"
: new PassphraseGeneratorOptionsEvaluator(policy); ? new PasswordGeneratorOptionsEvaluator(policy)
: new PassphraseGeneratorOptionsEvaluator(policy);
// Ensure the options to pass the current rules // Ensure the options to pass the current rules
const withPolicy = evaluator.applyPolicy(options); const withPolicy = evaluator.applyPolicy(options);
@@ -344,9 +345,10 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
options: PasswordGeneratorOptions, options: PasswordGeneratorOptions,
enforcedPolicyOptions: PasswordGeneratorPolicyOptions, enforcedPolicyOptions: PasswordGeneratorPolicyOptions,
) { ) {
const evaluator = options.type const evaluator =
? new PasswordGeneratorOptionsEvaluator(enforcedPolicyOptions) options.type == "password"
: new PassphraseGeneratorOptionsEvaluator(enforcedPolicyOptions); ? new PasswordGeneratorOptionsEvaluator(enforcedPolicyOptions)
: new PassphraseGeneratorOptionsEvaluator(enforcedPolicyOptions);
const evaluatedOptions = evaluator.applyPolicy(options); const evaluatedOptions = evaluator.applyPolicy(options);
const santizedOptions = evaluator.sanitize(evaluatedOptions); const santizedOptions = evaluator.sanitize(evaluatedOptions);