Module: Merb::Authentication::Mixins::SaltedUser::SQClassMethods

Defined in:
lib/merb-auth-more/mixins/salted_user/sq_salted_user.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/merb-auth-more/mixins/salted_user/sq_salted_user.rb', line 36

def self.extended(base)
  base.class_eval do
    unless Merb::Orms::Sequel.new_sequel?
      before_save :encrypt_password
      validates_presence_of     :password,                   :if => :password_required?
      validates_presence_of     :password_confirmation,      :if => :password_required?
      validates_confirmation_of :password,                   :if => :password_required?
    end
    include Merb::Authentication::Mixins::SaltedUser::SQInstanceMethods
  end
end

Instance Method Details

#authenticate(login, password) ⇒ Object

self.extended



48
49
50
51
# File 'lib/merb-auth-more/mixins/salted_user/sq_salted_user.rb', line 48

def authenticate(, password)
  @u = find(Merb::Authentication::Strategies::Basic::Base. => )
  @u && @u.authenticated?(password) ? @u : nil
end