Sha256: 3ab62183bac9adffdd1d671ed2132f82db7b6bb7efffae4e0f3a7b3ee4f537ca
Contents?: true
Size: 511 Bytes
Versions: 21
Compression:
Stored size: 511 Bytes
Contents
class PasswordStrengthValidator < ActiveModel::EachValidator # implement the method where the validation logic must reside def validate_each(record, attribute, value) password_validation_hash = record.password_validator || {:error_message => 'must be at least 8 characters long and start and end with a letter', :regex => '^[A-Za-z]\w{6,}[A-Za-z]$'} record.errors[attribute] << password_validation_hash[:error_message] unless Regexp.new(password_validation_hash[:regex]) =~ value end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
erp_tech_svcs-3.0.1 | app/validators/password_strength_validator.rb |