Skip to content
Snippets Groups Projects
Commit e702db14 authored by Calum Robinson's avatar Calum Robinson Committed by Rémy Coutable
Browse files

Be more permissive with email address validation: it only has to contain an '@'

Fixes #3851
parent 9fdd605f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment