Module: Merb::Authentication::Mixins::SaltedUser::InstanceMethods
- Defined in:
- lib/merb-auth-more/mixins/salted_user.rb
Instance Method Summary collapse
- #authenticated?(password) ⇒ Boolean
- #encrypt(password) ⇒ Object
- #encrypt_password ⇒ Object
- #password_required? ⇒ Boolean
Instance Method Details
#authenticated?(password) ⇒ Boolean
58 59 60 |
# File 'lib/merb-auth-more/mixins/salted_user.rb', line 58 def authenticated?(password) crypted_password == encrypt(password) end |
#encrypt(password) ⇒ Object
62 63 64 |
# File 'lib/merb-auth-more/mixins/salted_user.rb', line 62 def encrypt(password) self.class.encrypt(password, salt) end |
#encrypt_password ⇒ Object
70 71 72 73 74 |
# File 'lib/merb-auth-more/mixins/salted_user.rb', line 70 def encrypt_password return if password.blank? self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{Merb::Authentication::Strategies::Basic::Base.login_param}--") if salt.blank? self.crypted_password = encrypt(password) end |
#password_required? ⇒ Boolean
66 67 68 |
# File 'lib/merb-auth-more/mixins/salted_user.rb', line 66 def password_required? crypted_password.blank? || !password.blank? end |