module Authentication::ByPassword::ModelInstanceMethods

Instance Methods

Public Instance Methods

authenticated?(password) click to toggle source
# File lib/authentication/by_password.rb, line 49
def authenticated?(password)
  crypted_password == encrypt(password)
end
encrypt(password) click to toggle source

Encrypts the password with the user salt

# File lib/authentication/by_password.rb, line 45
def encrypt(password)
  self.class.password_digest(password, salt)
end
encrypt_password() click to toggle source

before filter

# File lib/authentication/by_password.rb, line 54
def encrypt_password
  return if password.blank?
  self.salt = self.class.make_token if new_record?
  self.crypted_password = encrypt(password)
end
password_required?() click to toggle source
# File lib/authentication/by_password.rb, line 59
def password_required?
  crypted_password.blank? || !password.blank?
end