summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalum Robinson <calum.robinson@sias.com>2016-01-14 10:00:42 +0000
committerRémy Coutable <remy@rymai.me>2016-02-08 15:40:19 +0100
commite702db14f0729a04f439ad526612d3802ad8d41b (patch)
treebc882b10adcb8e41a09066b6e44d2aac9ca9ecd5
parent9fdd605fd2e4550170e5ef088bec7c6d2585c4a5 (diff)
downloadgitlab-ce-calumr/gitlab-ce-simplify-email-validation.tar.gz
Be more permissive with email address validation: it only has to contain an '@'calumr/gitlab-ce-simplify-email-validation
Fixes #3851
-rw-r--r--CHANGELOG1
-rw-r--r--app/validators/email_validator.rb2
-rw-r--r--spec/models/user_spec.rb8
3 files changed, 6 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7572b6af151..025f226ef3f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@ v 8.5.0 (unreleased)
- Whitelist raw "abbr" elements when parsing Markdown (Benedict Etzel)
- Fix label links for a merge request pointing to issues list
- Don't vendor minified JS
+ - Be more permissive with email address validation: it only has to contain an '@' (Calum Robinson)
- Display 404 error on group not found
- Track project import failure
- Support Two-factor Authentication for LDAP users
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb
index b35af100803..116044d3fd0 100644
--- a/app/validators/email_validator.rb
+++ b/app/validators/email_validator.rb
@@ -8,7 +8,7 @@
# See http://www.remote.org/jochen/mail/info/chars.html
#
class EmailValidator < ActiveModel::EachValidator
- PATTERN = /\A\s*([-a-z0-9+._']{1,64})@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*\z/i.freeze
+ PATTERN = /@/.freeze
def validate_each(record, attribute, value)
unless value =~ PATTERN
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index cee051f5732..70412e59b40 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -140,14 +140,14 @@ describe User, models: true do
expect(user).to be_invalid
end
- it 'rejects mailto:test@example.com' do
+ it 'accepts mailto:test@example.com' do
user = build(:user, email: 'mailto:test@example.com')
- expect(user).to be_invalid
+ expect(user).to be_valid
end
- it "rejects lol!'+=?><#$%^&*()@gmail.com" do
+ it "accepts lol!'+=?><#$%^&*()@gmail.com" do
user = build(:user, email: "lol!'+=?><#$%^&*()@gmail.com")
- expect(user).to be_invalid
+ expect(user).to be_valid
end
context 'when no signup domains listed' do