Class: Rails::Authentication::Strategies::Basic::Form

Inherits:
Base show all
Defined in:
lib/rails-auth/strategies/password_form.rb

Instance Attribute Summary

Attributes inherited from Rails::Authentication::Strategy

#body, #params, #request, #status

Instance Method Summary collapse

Methods inherited from Base

#login_param, login_param, password_param, #password_param

Methods inherited from Rails::Authentication::Strategy

abstract!, abstract?, after, before, #cookies, #halt!, #halted?, #headers, inherited, #initialize, #redirect!, #redirected?, #session, #user_class

Constructor Details

This class inherits a constructor from Rails::Authentication::Strategy

Instance Method Details

#run!Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/rails-auth/strategies/password_form.rb', line 18

def run!
  if request.params[] && request.params[password_param]
    user = user_class.authenticate(request.params[], request.params[password_param])
    if !user
      request.session.authentication.errors.clear!
      request.session.authentication.errors.add(, strategy_error_message)
    end
    user
  end
end

#strategy_error_messageObject

run!



29
30
31
# File 'lib/rails-auth/strategies/password_form.rb', line 29

def strategy_error_message
  "#{.to_s.capitalize} or #{password_param.to_s.capitalize} were incorrect"
end