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

Issues with validators

Abierto
#270 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
215
Forks
98
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.