FIX: match subdomain with email domain blacklist

This commit is contained in:
Arpit Jalan
2015-05-13 17:38:10 +05:30
parent 51d82fc25d
commit 220b9c5abe
2 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class EmailValidator < ActiveModel::EachValidator
def email_in_restriction_setting?(setting, value)
domains = setting.gsub('.', '\.')
regexp = Regexp.new("@(#{domains})", true)
regexp = Regexp.new("@(.+\.)?(#{domains})", true)
value =~ regexp
end