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-4.0.0 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.8 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.7 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.5 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.4 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.3 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.2 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.1 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.12 app/validators/password_strength_validator.rb
erp_tech_svcs-3.1.0 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.11 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.10 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.9 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.8 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.7 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.6 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.5 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.4 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.3 app/validators/password_strength_validator.rb
erp_tech_svcs-3.0.2 app/validators/password_strength_validator.rb