Class: NeverLeakedToHibpValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- NeverLeakedToHibpValidator
- Defined in:
- lib/has_unpublished_password/never_leaked_to_hibp_validator.rb
Overview
Must be a top-level constant so rails can find it.
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 |
# File 'lib/has_unpublished_password/never_leaked_to_hibp_validator.rb', line 4 def validate_each(record, attribute, value) if HasUnpublishedPassword.has_been_published? value record.errors[attribute] << ([:message] || "That's one of the first passwords a hacker would try.") end end |