Module: Authentication::ByPassword::ModelInstanceMethods
- Defined in:
- lib/branston/vendor/plugins/restful_authentication/lib/authentication/by_password.rb
Overview
Instance Methods
Instance Method Summary collapse
- #authenticated?(password) ⇒ Boolean
-
#encrypt(password) ⇒ Object
Encrypts the password with the user salt.
-
#encrypt_password ⇒ Object
before filter.
- #password_required? ⇒ Boolean
Instance Method Details
#authenticated?(password) ⇒ Boolean
49 50 51 |
# File 'lib/branston/vendor/plugins/restful_authentication/lib/authentication/by_password.rb', line 49 def authenticated?(password) crypted_password == encrypt(password) end |
#encrypt(password) ⇒ Object
Encrypts the password with the user salt
45 46 47 |
# File 'lib/branston/vendor/plugins/restful_authentication/lib/authentication/by_password.rb', line 45 def encrypt(password) self.class.password_digest(password, salt) end |
#encrypt_password ⇒ Object
before filter
54 55 56 57 58 |
# File 'lib/branston/vendor/plugins/restful_authentication/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? ⇒ Boolean
59 60 61 |
# File 'lib/branston/vendor/plugins/restful_authentication/lib/authentication/by_password.rb', line 59 def password_required? crypted_password.blank? || !password.blank? end |