Module: Merb::Authentication::Mixins::BCryptUser::InstanceMethods
- Defined in:
- lib/merb-auth-more/mixins/bcrypt_user.rb
Instance Method Summary collapse
- #authenticated?(password) ⇒ Boolean
- #bcrypt_password ⇒ Object
- #encrypt_password ⇒ Object
- #password_required? ⇒ Boolean
Instance Method Details
#authenticated?(password) ⇒ Boolean
49 50 51 |
# File 'lib/merb-auth-more/mixins/bcrypt_user.rb', line 49 def authenticated?(password) bcrypt_password == password end |
#bcrypt_password ⇒ Object
53 54 55 |
# File 'lib/merb-auth-more/mixins/bcrypt_user.rb', line 53 def bcrypt_password @bcrypt_password ||= BCrypt::Password.new(crypted_password) end |
#encrypt_password ⇒ Object
61 62 63 64 65 |
# File 'lib/merb-auth-more/mixins/bcrypt_user.rb', line 61 def encrypt_password return if password.blank? cost = Merb::Plugins.config[:"merb-auth"][:bcrypt_cost] || BCrypt::Engine::DEFAULT_COST self.crypted_password = BCrypt::Password.create(password, :cost => cost) end |
#password_required? ⇒ Boolean
57 58 59 |
# File 'lib/merb-auth-more/mixins/bcrypt_user.rb', line 57 def password_required? crypted_password.blank? || !password.blank? end |