1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

refactor(set-change-password): [Auth/PM-17649] Move and test compareInputs validator (#13553)

- Move the `compareInputs` validator to `libs/auth`
- Add tests for the `compareInputs` validator
- Delete the deprecated `InputsFieldMatch` class (inputs-field-match.validator.ts)
This commit is contained in:
rr-bw
2025-04-07 15:04:24 -07:00
committed by GitHub
parent 19d59212a8
commit ecb4b2d0b7
5 changed files with 365 additions and 179 deletions

View File

@@ -25,13 +25,11 @@ import {
} from "@bitwarden/components";
import { DEFAULT_KDF_CONFIG, KeyService } from "@bitwarden/key-management";
// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { InputsFieldMatch } from "../../../../angular/src/auth/validators/inputs-field-match.validator";
// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { SharedModule } from "../../../../components/src/shared";
import { PasswordCalloutComponent } from "../password-callout/password-callout.component";
import { compareInputs, ValidationGoal } from "../validators/compare-inputs.validator";
import { PasswordInputResult } from "./password-input-result";
@@ -113,21 +111,21 @@ export class InputPasswordComponent implements OnInit {
},
{
validators: [
InputsFieldMatch.compareInputs(
"doNotMatch",
compareInputs(
ValidationGoal.InputsShouldNotMatch,
"currentPassword",
"newPassword",
this.i18nService.t("yourNewPasswordCannotBeTheSameAsYourCurrentPassword"),
),
InputsFieldMatch.compareInputs(
"match",
"newPassword",
"confirmNewPassword",
compareInputs(
ValidationGoal.InputsShouldMatch,
"password",
"confirmedPassword",
this.i18nService.t("masterPassDoesntMatch"),
),
InputsFieldMatch.compareInputs(
"doNotMatch",
"newPassword",
compareInputs(
ValidationGoal.InputsShouldNotMatch,
"password",
"hint",
this.i18nService.t("hintEqualsPassword"),
),