class NeverLeakedToHibpValidator

Must be a top-level constant so rails can find it.

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/has_unpublished_password/never_leaked_to_hibp_validator.rb, line 4
def validate_each(record, attribute, value)
  return unless value
  if HasUnpublishedPassword.has_been_published? value
    record.errors.add(attribute, (options[:message] || "That's one of the first passwords a hacker would try."))
  end
end