class ActiveModel::Validations::ZxcvbnPasswordValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/tough/validators/zxcvbn_password_validator.rb, line 4 def validate_each(record, attribute, value) #0 too guessable: risky password. (guesses < 10^3) #1 very guessable: protection from throttled online attacks. (guesses < 10^6) #2 somewhat guessable: protection from unthrottled online attacks. (guesses < 10^8) #3 safely unguessable: moderate protection from offline slow-hash scenario. (guesses < 10^10) #4 very unguessable: strong protection from offline slow-hash scenario. (guesses >= 10^10) unless Zxcvbn.test(value).score >= Tough.zxcvbn_minimum_score_to_pass record.errors[attribute] << Tough.zxcvbn_error_message end end