#12196 closed (invalid)
EmailField reject this email address tosha...99@gmail.com
Reported by: | mtsyganov | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
To fix that problem, just change
email_re = re.compile( r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain
TO
email_re = re.compile( r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]*)*" # dot-atom r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain
in the file django.forms.fields.py
I just replaced in the first line the + to *
Attachments (3)
Change History (17)
comment:1 by , 15 years ago
Description: | modified (diff) |
---|
by , 15 years ago
Attachment: | 12196.diff added |
---|
follow-up: 3 comment:2 by , 15 years ago
Has patch: | set |
---|
comment:3 by , 15 years ago
Replying to simonz05:
Fix suggested in description seems to work.
I'm no regex master, though. So for all I know the regex might not be a good solution.
Test are passed .. ok.
So works for me.
by , 15 years ago
Attachment: | 12196-2.diff added |
---|
comment:4 by , 15 years ago
I've added another patch, the current one allowed the local-part to end with a dot (see http://tools.ietf.org/html/rfc2822#section-3.4.1 for email specifications).
comment:5 by , 15 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:6 by , 15 years ago
milestone: | 1.2 |
---|
1.2 is feature-frozen, moving this feature request off the milestone.
(and yes, asking for more lax email validation is a feature request)
by , 14 years ago
Attachment: | 12196.2.diff added |
---|
comment:7 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I've updated the patch to use the new EmailValidator
.
comment:8 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
All the tools I can find that seem to do a decent job of implementing RFC 822 (e.g. http://www.ex-parrot.com/pdw/Mail-RFC822-Address/Mail-RFC822-Address.html and http://www.regular-expressions.info/email.html ) say that "tosha...99@…" is an invalid e-mail address. So I'm closing INVALID - because if we are being even more liberal than RFC 822, we really don't have any standard to reject any e-mail address. Please re-open if you can show that it is a valid e-mail address.
comment:9 by , 14 years ago
Just to add a bit more - gmail does not even allow you to create e-mail addresses like that - it says "Sorry, your username cannot contain consecutive periods (.)"
comment:10 by , 14 years ago
GMail actually ignore dots in emails, e.g. mails to tosha...99@… and tosha99@… will end in the same mailbox. So tosha...99@… WOULD be a valid email address, as it will be mapped to tosha99@… by GMail.
comment:11 by , 14 years ago
OK, but you can't specify an e-mail address like that when you sign up, and so the 'canonical' form that gmail displays to you will be a form that is accepted by our e-mail validator. So there is no reason to change it.
comment:12 by , 14 years ago
Well, except if you're using a provider like hushmail.com who allows all those dots (in signup too).
No matter how you twist it, Django refuses valid emails without this change.
comment:13 by , 14 years ago
No, they aren't valid, from Wikipedia: "Character . (dot, period, full stop) provided that it is not the first or last character, and provided also that it does not appear two or more times consecutively (e.g. John..Doe@…)."
comment:14 by , 14 years ago
RFC 3696 exists to provide guidance on this topic, and states in section 3: "period (".") may also appear, but may not be used to start or end the local part, nor may two or more consecutive periods appear."
Leaving invalid.
Please use preview.