1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Fix default email_regexp config to disallow trailing non-word characters

This commit is contained in:
Sean Marzug-McCarthy 2015-06-22 15:41:49 +02:00
parent 3dc15c03a7
commit d49533bedc
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,7 @@ module Devise
# an one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
mattr_accessor :email_regexp
@@email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
@@email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
# Range validation for password length
mattr_accessor :password_length

View file

@ -95,7 +95,7 @@ class DeviseTest < ActiveSupport::TestCase
test 'Devise.email_regexp should match valid email addresses' do
valid_emails = ["test@example.com", "jo@jo.co", "f4$_m@you.com", "testing.example@example.com.ua"]
non_valid_emails = ["rex", "test@go,com", "test user@example.com", "test_user@example server.com"]
non_valid_emails = ["rex", "test@go,com", "test user@example.com", "test_user@example server.com", "test_user@example.com."]
valid_emails.each do |email|
assert_match Devise.email_regexp, email