adopted-ember-addons / adopted-ember-addons/ember-changeset-validations
Issues with validators
- 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
Avaliação
Esta issue ainda não foi avaliada.