Parsley accepts tld's with single character
opened this issue · comments
What kind of issue is this? (put 'x' between the square brackets)
-
Question. This issue tracker is not the place for questions. If you want to ask how to do
something, or to understand why something isn't working the way you expect it to, use
http://stackoverflow.com/questions/ask .
Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101.
We monitor the tagparsley.js
. -
[x ] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen,
starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 . -
Feature Request. Make sure there's no good way to do what you want first;
consider asking on http://stackoverflow.com/questions/ask first.
example: https://codepen.io/henzestplus/pen/BaBxoJK?editors=101#anon-signup
topleveldomains are at least 2 characters, I am using sendinblue, and they seem to deny e-mail addresses with a single topleveldomain character.
parsley@parsley.c should fail, while parsley@parsley.co even though it might not exist, should succeed.Instead, both succeed.
Here is a replacement email address validator I had to create for my project that fixes that problem for the meantime.
// Parsley's email validator allows 1 character for the TLD (after the final dot) while the correct minimum is 2 characters
// this validator (data-parsley-real-email) uses a corrected version of Parsley's built-in RE
window.Parsley.addValidator('realEmail', {
requirementType: 'string',
validateString: function(value) {
return /^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2}|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/.test(value);
},
priority: 256
});
I pushed a fix but now my test environment is broken. I don't know when I'll have the time to shave that yak...
Yak shaved, fix released a while back.
Thanks for the report 👍