-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow apostrophes in email address #12729
Conversation
The email validation regex is too restrictive and does not allow apostrophes. Even with this change, the regex is probably still too restrictive. I am personally in favor of advice outlined in [this post](https://davidcel.is/posts/stop-validating-email-addresses-with-regex/), which is, to summarize: 1) Don't validate emails with regex, send an email to it instead 2) If you must, use a very permissive one Since both (1) is probably beyond the scope of this bugfix, and (2) breaks existing tests (and I don't know if there are good reasons for their being there), I want to recommend that we fix the specific problem outlined in the BZ first, and try to address the general problem in a follow up. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1379420
Checked commit imtayadeway@959d6f0 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 app/models/user.rb
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
@@ -36,7 +36,7 @@ class User < ApplicationRecord | |||
|
|||
validates_presence_of :name, :userid | |||
validates :userid, :uniqueness => {:conditions => -> { in_my_region } } | |||
validates_format_of :email, :with => /\A([\w\.\-\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, | |||
validates_format_of :email, :with => /\A([\w\.\-\+']+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imtayadeway @gtanzillo Maybe this regex should be used, instead?
Allow apostrophes in email address (cherry picked from commit f728774) https://bugzilla.redhat.com/show_bug.cgi?id=1396489
Euwe Backport details: $ git log -1
commit 6da4b096e7bd0bf6d232f34e2e4269a4b4761b0f
Author: Gregg Tanzillo <[email protected]>
Date: Thu Nov 17 17:21:11 2016 -0500
Merge pull request #12729 from imtayadeway/fix/email-validation
Allow apostrophes in email address
(cherry picked from commit f728774fb1db4c4e48246f27dbb9f0f50a4162d8)
https://bugzilla.redhat.com/show_bug.cgi?id=1396489 |
Allow apostrophes in email address (cherry picked from commit f728774) https://bugzilla.redhat.com/show_bug.cgi?id=1396490
Darga Backport details: $ git log -1
commit b913c33bdcad5bc30ae8f280fda3cc0bb27c4ebb
Author: Gregg Tanzillo <[email protected]>
Date: Thu Nov 17 17:21:11 2016 -0500
Merge pull request #12729 from imtayadeway/fix/email-validation
Allow apostrophes in email address
(cherry picked from commit f728774fb1db4c4e48246f27dbb9f0f50a4162d8)
https://bugzilla.redhat.com/show_bug.cgi?id=1396490 |
The email validation regex is too restrictive and does not allow
apostrophes.
Even with this change, the regex is probably still too
restrictive. I am personally in favor of advice outlined in
this post,
which is, to summarize:
Since both (1) is probably beyond the scope of this bugfix, and (2)
breaks existing tests (and I don't know if there are good reasons for
their being there), I want to recommend that we fix the specific problem
outlined in the BZ first, and try to address the general problem in a
follow up.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1379420
@miq-bot add-label bug, core, blocker
@miq-bot assign @gtanzillo