Fixed validation of email addresses when the local part contains an @.
See also BaseUserManager.normalize_email -- it uses rsplit. Refs #4833.
This commit is contained in:
parent
58062a6302
commit
424eb67867
|
@ -106,7 +106,7 @@ class EmailValidator(object):
|
|||
if not value or '@' not in value:
|
||||
raise ValidationError(self.message, code=self.code)
|
||||
|
||||
user_part, domain_part = value.split('@', 1)
|
||||
user_part, domain_part = value.rsplit('@', 1)
|
||||
|
||||
if not self.user_regex.match(user_part):
|
||||
raise ValidationError(self.message, code=self.code)
|
||||
|
|
|
@ -31,6 +31,7 @@ TEST_DATA = (
|
|||
(validate_email, 'test@domain.with.idn.tld.उदाहरण.परीक्षा', None),
|
||||
(validate_email, 'email@localhost', None),
|
||||
(EmailValidator(whitelist=['localdomain']), 'email@localdomain', None),
|
||||
(validate_email, '"test@test"@example.com', None),
|
||||
|
||||
(validate_email, None, ValidationError),
|
||||
(validate_email, '', ValidationError),
|
||||
|
|
Loading…
Reference in New Issue