diff options
author | leonidguadalupe <leonid.guadalupe@xeneta.com> | 2021-08-31 13:50:34 +0800 |
---|---|---|
committer | Alec Thomas <alec@swapoff.org> | 2021-08-31 20:10:44 +1000 |
commit | e5e3b51fe86523442f09446916f834c16c7d15d6 (patch) | |
tree | c7c7cd814e799f37a03904f2fadaf8dd2e3af4ff | |
parent | 1720439e4848d966707002707e825b448ab40342 (diff) | |
download | voluptuous-e5e3b51fe86523442f09446916f834c16c7d15d6.tar.gz |
Change email regex match to fullmatch
This PR is about the current method used to conditionally match user and domain regex to email.
currently, it's using match which wrongfully accepts entries if domain has special characters after .com
it currently accepts, john@voluptuous.com> or john!@voluptuous.org!@($*!
thus, we need to fullmatch the domain or user to avoid such entries and validate them properly.
-rw-r--r-- | voluptuous/validators.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/voluptuous/validators.py b/voluptuous/validators.py index e8f8a8b..5f72cf6 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -435,7 +435,7 @@ def Email(v): raise EmailInvalid("Invalid email address") user_part, domain_part = v.rsplit('@', 1) - if not (USER_REGEX.match(user_part) and DOMAIN_REGEX.match(domain_part)): + if not (USER_REGEX.fullmatch(user_part) and DOMAIN_REGEX.fullmatch(domain_part)): raise EmailInvalid("Invalid email address") return v except: |