module Hello::RailsActiveRecord::PasswordCredential

Attributes

password[R]

SETTERS

Public Instance Methods

password=(value) click to toggle source
# File lib/hello/rails_active_record/password_credential.rb, line 19
def password=(value)
  # puts "password=('#{value}')".blue
  self.digest = @password = nil if value.blank?
  @password = value

  self.digest = complex_encryptor.encrypt(value)
end
password_is?(plain_text_password) click to toggle source

CUSTOM METHODS

# File lib/hello/rails_active_record/password_credential.rb, line 29
def password_is?(plain_text_password)
  complex_encryptor.match(plain_text_password, digest)
end
set_generated_password() click to toggle source
# File lib/hello/rails_active_record/password_credential.rb, line 33
def set_generated_password
  self.password = simple_encryptor.single(4) # 8 chars
end

Private Instance Methods

hello_validations() click to toggle source
# File lib/hello/rails_active_record/password_credential.rb, line 39
def hello_validations
  return if errors.has_key?(:password)
  c = Hello.configuration
  validates_length_of :password, in: c.password_length
  return if errors.has_key?(:password)
  validates_format_of :password, with: c.password_regex
end