Handle empty BLOCKED_EMAILS

parent ce2798da
......@@ -2,7 +2,7 @@
class EmailPermutationValidator < ActiveModel::Validator
def validate(user)
return if user.email.blank?
return if skip_validate? user
@email = user.email
@blocked_emails = ENV['BLOCKED_EMAILS'].split(',')
......@@ -11,6 +11,10 @@ class EmailPermutationValidator < ActiveModel::Validator
private
def skip_validate?(user)
user.email.blank? or ENV['BLOCKED_EMAILS'].blank?
end
def blocked_email?
@blocked_emails.include? stripped_dots_email
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment