1
0
mirror of https://github.com/django/django.git synced 2025-04-09 07:56:43 +00:00

Update validators.py

Updated file to make Email Validator and Email Field max length as equal(254 characters as per RFC 5321).
This commit is contained in:
Kushagra S 2024-01-18 21:44:47 +05:30 committed by GitHub
parent 10c7c7320b
commit ec387f7c0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -204,9 +204,9 @@ class EmailValidator:
self.domain_allowlist = allowlist
def __call__(self, value):
# The maximum length of an email is 320 characters per RFC 3696
# The maximum length of an email is 254 characters per RFC 5321
# section 3.
if not value or "@" not in value or len(value) > 320:
if not value or "@" not in value or len(value) > 254:
raise ValidationError(self.message, code=self.code, params={"value": value})
user_part, domain_part = value.rsplit("@", 1)