Frontend email validation should match wtforms

Our long email regex for the frontend was stricter in some ways, but it allowed
email addresses with a single-letter TLD ("frank@dod.m"), which the backend
WTForms validator would reject. The two should be equivalent.

Reference:
1939aec691/wtforms/validators.py (validators.py-281)
This commit is contained in:
dandds 2019-04-25 10:23:58 -04:00
parent 054d030e15
commit 124970f9d6

View File

@ -35,7 +35,7 @@ export default {
},
email: {
mask: emailMask,
match: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i,
match: /^.+@[^.].*\.[a-z]{2,10}$/,
unmask: [],
validationError: 'Please enter a valid e-mail address',
},