Class: PasswordStrengthValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- PasswordStrengthValidator
- Defined in:
- lib/validates_password_strength/password_strength_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attr_name, value) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/validates_password_strength/password_strength_validator.rb', line 5 def validate_each(record, attr_name, value) [:min] ||= 5 if ValidatesPasswordStrength::Checker.get_password_strength(value) < [:min] record.errors.add(attr_name, :weak_password, ) end end |