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

Issues with validators

Đang mở
#270 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
215
Fork
98
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.