Instance Methods
# File lib/authentication/by_password.rb, line 49 def authenticated?(password) crypted_password == encrypt(password) end
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
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
# File lib/authentication/by_password.rb, line 59 def password_required? crypted_password.blank? || !password.blank? end