philnash / pwned

😱 An easy, Ruby way to use the Pwned Passwords API.
https://rubygems.org/gems/pwned/
MIT License
421 stars 22 forks source link

Pwned validator threshold #6

Closed philnash closed 6 years ago

philnash commented 6 years ago

Adds a threshold to the PwnedValidator so that you can let less pwned passwords still be valid if you so choose.

class User < ApplicationRecord
  # The record is marked as valid if the password has been used once in the breached data
  validates :password, pwned: { threshold: 1 }
end
kpumuk commented 6 years ago

Looks super clean 👍