otwarchive-symphonyarchive/app/validators/email_blacklist_validator.rb
2026-03-11 22:22:11 +00:00

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