spree/spree — Issue #1238: Orders#email validation regex fails to validate some syntactically legal email addresses
Author: mscottford
Created: 2012-03-06 16:37:48+00:00
State: open

I just came across an order with an email address similar to `o'brien@example.com`. I did not think that would be legal, but after some research, it turns out that it is according to RFC 8222 section 3.2.4[1].

I tried exploring a way to change the regex, but ActiveModel makes that difficult with accessing the private class attribute `_validators`. I'm going to fork Spree instead and add an `'` to the regex.

I thought it would be worth opening up discussion about how a general solution should function. Should we improve the regex to support all syntactically legal email addresses? Should we instead make the regex something that can be changed? What about doing both?

[1]: http://tools.ietf.org/html/rfc2822#section-3.2.4