Opened 11 years ago
Last modified 6 years ago
#27270 new defect (bug)
Validation for leading/trailing periods, or consecutive periods in email addresses is only done on the domain section
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7 |
Component: | Formatting | Keywords: | has-patch is-email has-unit-tests |
Focuses: | Cc: |
Description
WordPress valids that the domain portion of the email address (after the @) doesn't have leading or trailing periods, or more than one period consecutively, but the same check isn't done on the portion before the @. This means that the following email addresses validate:
.name@…
name.@…
first..last@…
The attached patch will resolve this, although it might need a little refactoring to deal with the duplication in trimming periods and whitespace.
Attachments (2)
Change History (12)
#1
@
11 years ago
- Keywords 2nd-opinion added
Consecutive periods are perfectly valid in the local part of an email address. I'm unsure about leading and trailing periods though.
#3
@
11 years ago
I don't think so. The spec says:
"period (".") may also appear, but may not be used to start or end the local part, nor may two or more consecutive periods appear." (http://tools.ietf.org/html/rfc3696#page-5)
#4
@
11 years ago
Ah, I stand corrected. That's interesting because I have an address that I use in Gmail which contains three consecutive periods.
More email validation fun: https://core.trac.wordpress.org/search?q=is_email&ticket=on
#5
@
11 years ago
Weird. I wonder if Gmail uses the quoted string syntax to get past these rules? (http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses).
Just a theory...
#8
@
10 years ago
- Keywords needs-unit-tests removed
I've tested the patch, and it works as advertised. I've re-rolled the patch (to make sure it applies cleanly to trunk, and to be a little more verbose in the comments), and updated the unit test as well.
I think this is ready to be committed.
#10
@
9 years ago
- Keywords has-unit-tests added
This patch still applies -- can we try to get this in for the 4.5 release?
Also, by way of answering John's question about why it works in Gmail, they have a page that explains that they ignore all periods in the user part of email: https://support.google.com/mail/answer/10313?hl=en
Email validation patch