Module: Merb::Authentication::Mixins::SaltedUser::SQClassMethods
- Defined in:
- lib/heedley-merb-auth-with-account/mixins/salted_user/sq_salted_user.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#authenticate(login, password) ⇒ Object
self.extended.
Class Method Details
.extended(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/heedley-merb-auth-with-account/mixins/salted_user/sq_salted_user.rb', line 6 def self.extended(base) base.class_eval do validates_presence_of :password, :if => :password_required? validates_presence_of :password_confirmation, :if => :password_required? validates_confirmation_of :password, :if => :password_required? before_save :encrypt_password include Merb::Authentication::Mixins::SaltedUser::SQInstanceMethods end # base.class_eval end |
Instance Method Details
#authenticate(login, password) ⇒ Object
self.extended
21 22 23 24 |
# File 'lib/heedley-merb-auth-with-account/mixins/salted_user/sq_salted_user.rb', line 21 def authenticate(login, password) @u = find(Merb::Authentication::Strategies::Basic::Base.login_param => login) @u && @u.authenticated?(password) ? @u : nil end |