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

Issues with validators

Aberta
#270 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
215
Forks
98
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.