diff options
author | Guillaume Lo Re <lowreg@gmail.com> | 2017-04-26 01:22:51 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-26 01:22:51 +0200 |
commit | 7177e37b999d0a8b4e0382c193bcb973443a756f (patch) | |
tree | 04ca32a0a03dd30acc4e56bb63e826bded04d9e5 /app/validators | |
parent | fbc509940266dc9de1a197e2261608257396b5a7 (diff) |
Stricter whitelist rules (#2213)
* Stricter whitelist rules * Linting * Added spec for blacklisting * Test subdomain blacklist on domain whitelist * No need to split * Change spec name
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/email_validator.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb index 06e9375f6..141f209d5 100644 --- a/app/validators/email_validator.rb +++ b/app/validators/email_validator.rb @@ -15,7 +15,7 @@ class EmailValidator < ActiveModel::EachValidator return false if Rails.configuration.x.email_domains_blacklist.blank? domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.') - regexp = Regexp.new("@(.+\\.)?(#{domains})", true) + regexp = Regexp.new("@(.+\\.)?(#{domains})", true) value =~ regexp end @@ -24,7 +24,7 @@ class EmailValidator < ActiveModel::EachValidator return false if Rails.configuration.x.email_domains_whitelist.blank? domains = Rails.configuration.x.email_domains_whitelist.gsub('.', '\.') - regexp = Regexp.new("@(.+\\.)?(#{domains})", true) + regexp = Regexp.new("@(.+\\.)?(#{domains})$", true) value !~ regexp end |