Module: Merb::Authentication::Mixins::SaltedUser::RDBClassMethods
- Defined in:
- lib/heedley-merb-auth-with-account/mixins/salted_user/relaxdb_salted_user.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/heedley-merb-auth-with-account/mixins/salted_user/relaxdb_salted_user.rb', line 6 def self.extended(base) base.class_eval do property :crypted_password property :salt before_save :password_checks def password_checks if password_required? return false unless !password.blank? && password == password_confirmation end encrypt_password true end end end |
Instance Method Details
#authenticate(login, password) ⇒ Object
25 26 27 28 29 |
# File 'lib/heedley-merb-auth-with-account/mixins/salted_user/relaxdb_salted_user.rb', line 25 def authenticate(login, password) login_param = Merb::Authentication::Strategies::Basic::Base.login_param @u = all.sorted_by(login_param) { |q| q.key(login) }.first @u && @u.authenticated?(password) ? @u : nil end |