Sha256: 65f8402ecb415577e8c63fe895dbf8bad93ef10a10ff0d25a3b34b3d2a99999e

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

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

class NeverLeakedToHibpValidator < ActiveModel::EachValidator
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_unpublished_password-0.2.2 lib/has_unpublished_password/never_leaked_to_hibp_validator.rb