#31053: EmailValidator should not accept soft hyphen in email addresses.
-----------------------------+--------------------------------------
Reporter: Mogoh Viol | Owner: nobody
Type: Bug | Status: closed
Component: Core (Mail) | Version: master
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by Mogoh Viol):
Ok, I have made a mistake, but I am still not a 100% convinced.
Indeed the EmailValidator accepts non-ascii domains.
It does not accept, non-ascii local-parts as in the example below.
{{{
In [2]: from django.core import validators
...: validators.validate_email('to@éxample.com')
...: validators.validate_email('tó@example.com')
---------------------------------------------------------------------------
ValidationError Traceback (most recent call
last)
<ipython-input-2-1da70ef004db> in <module>
1 from django.core import validators
2 validators.validate_email('to@éxample.com')
----> 3 validators.validate_email('tó@example.com')
~/.local/share/virtualenvs/website-10TxyhRr/lib/python3.6/site-
packages/django/core/validators.py in __call__(self, value)
194
195 if not self.user_regex.match(user_part):
--> 196 raise ValidationError(self.message, code=self.code)
197
198 if (domain_part not in self.domain_whitelist and
ValidationError: ['Bitte gültige E-Mail-Adresse eingeben.']
}}}
'''However, this is a different issue (if this is an issue at all).'''
The questions remains: Is a domain containing a soft hyphen a valid
domain?
I guess not, but I honestly don't know.
I think, it is really complicated, to test for a valid domain, including
only allowed unicode characters.
So I understand, that we only make a simple "sanity test" and, in case of
doubt, allow more invalid email-addresses.
If know one else thinks, filtering out emails with soft hyphens is a good
idea, we can leave the bug closed.
--
Ticket URL: <https://code.djangoproject.com/ticket/31053#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.306690b53dc91366e07eaeb56762c687%40djangoproject.com.