10 lines
313 B
Ruby
10 lines
313 B
Ruby
class EmailBlacklistValidator < ActiveModel::EachValidator
|
|
def validate_each(record,attribute,value)
|
|
if AdminBlacklistedEmail.is_blacklisted?(value)
|
|
record.errors.add(attribute, options[:message] || I18n.t("validators.email.blacklist"))
|
|
return false
|
|
else
|
|
return true
|
|
end
|
|
end
|
|
end
|