adopted-ember-addons / adopted-ember-addons/ember-changeset-validations

Issues with validators

Ouverte
#270 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
215
Forks
98
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## Code Snippet
```
@tracked model = {
newPassword: '',
confirmPassword: ''
};
@tracked validatorsAreLoaded = false;
constructor() {
super(...arguments);
this.createFormValidations();
}
async createFormValidations() {
await this.passwordStrength.load();
this.setPasswordValidation = {
newPassword: [
validatePresence({presence: true}),
validateLength({
min: this.minLength,
max: this.maxLength
}),
validatePasswordStrength({
minScore: 3,
passwordStrengthService: this.passwordStrength,
passwordStrengthResults: this.passwordStrengthResult,
message: this.intl.lookup('validations.passwordStrength')
})],
confirmPassword: [
validateConfirmation({
on: 'newPassword',
message: this.intl.lookup('validations.passwordsDoNotMatch')
})]
};
this.formChangeset = new Changeset(
this.model,
lookupValidator(this.setPasswordValidation),
this.setPasswordValidation
);
this.validatorsAreLoaded = true;
}
```

## Version
3.10.0

## Expected Behavior

Expect it to validate the new password / confirm password with the validators.

## Actual Behavior

The only validator that runs is `validatePasswordStrength` which is a custom validator I've created. Any help would be appreciated. `validateConfirmation` always evaluates to true even when there's nothing in `newPassword`, and `newPassword` doesn't seem to be evaluated either.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.