diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/validators/email_validator.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 8 |
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 |