Devise.email_regexp matches invalid email test@providercom
[25] pry(main)> 'test@providercom'.match(Devise.email_regexp)
=> #<MatchData "test@providercom">
It does not match
Hi @prog1dev, thanks for reporting this.
I think we can include in the regex that the domain part should have a dot on it. We probably would need to include this in a major version though.
Are you willing to take a stab on this? If you are, let me know, otherwise, I'll leave it open for others to grab.
Thanks!
@tegon can I take this one? 馃槃
@CaiqueMitsuoka Sure thing, go ahead! 馃殌
Hey
I did some digging into this problem, we I have a doubt, not sure which path to take.
So theoretically an email without the top level domain is valid. In the specification, the domain portion of the address need match the requirement for a hostname, which indeed would match @providercom since it can be used as local domain like in ax intranet.
My question is if we would like to support this use case? If so, no patch is needed.
Some reading that I think can help:
The discussion on the PR#4001 which is agreed to leave is as open as possible
Most of the discussion that I found point out to the Wikipedia's Email address domain definition of which has examples.
cc @tegon @rafaelfranca
@CaiqueMitsuoka Thanks for digging into this, I didn't know about that.
After reading the discussion in the previous PR I think it's better to leave as it is today. As a library, it's better for Devise to be more general and leave the more restrict rules for the applications that want to add that behavior.
@prog1dev If you want to add this rule in your application, you can use the email_regexp configuration option.
Thanks!
Most helpful comment
@tegon can I take this one? 馃槃