Fixed incorrect validation when member's name is too long

no issue

- the email length validation was conditional on `member.name` rather than `member.email` so if the name was too long both name and email were marked as invalid
This commit is contained in:
Kevin Ansfield 2020-05-11 11:40:38 +01:00
parent 07f24e69f6
commit 59a15a0895

View File

@ -16,13 +16,13 @@ export default BaseValidator.create({
let email = model.get('email');
if (isBlank(email)) {
model.get('errors').add('email', 'Please enter an email.');
model.errors.add('email', 'Please enter an email.');
this.invalidate();
} else if (!validator.isEmail(email)) {
model.get('errors').add('email', 'Invalid Email.');
model.errors.add('email', 'Invalid Email.');
this.invalidate();
}
if (!validator.isLength(model.name || '', 0, 191)) {
if (!validator.isLength(model.email || '', 0, 191)) {
model.errors.add('email', 'Email cannot be longer than 191 characters.');
this.invalidate();
}
@ -34,7 +34,7 @@ export default BaseValidator.create({
let note = model.get('note');
if (!validator.isLength(note || '', 0, 500)) {
model.get('errors').add('note', 'Note is too long.');
model.errors.add('note', 'Note is too long.');
this.invalidate();
}