Opened 14 years ago
Closed 14 years ago
#14583 closed (duplicate)
EmailField rejects valid emails if followed by trailing whitespace
Reported by: | Eloff | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I just had this issue on a production django site, reported by a customer. The form was rejecting his email address and he did not know why. I confirmed that the email address passes validation just fine, but that he was consistently entering trailing whitespace in the form field that caused it and others to fail validation.
I think the logical thing to do here, since leading and trailing whitespace cannot be significant to an email, and may also cause issues when using the cleaned value, is to override to_python on EmailField to strip() the value. I have hot-patched django in my website to do this, and it has resolved the issue for me.
Duplicate of #11907, fixed in [13997] (which will be part of 1.2.3 when it is released)