Class: Merb::Authentication::Strategies::Multisite::Form

Inherits:
Base
  • Object
show all
Defined in:
lib/merb-auth-more/strategies/multisite/multisite_password_form.rb

Overview

custom strategy taking into account site_id and authenticating with it the authenticate method is already well defined so for now I made a muck of if/else statements

Instance Method Summary collapse

Methods inherited from Base

#login_param, login_param, password_param, #password_param, site_id_param, #site_id_param

Instance Method Details

#run!Object



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/merb-auth-more/strategies/multisite/multisite_password_form.rb', line 58

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

#strategy_error_messageObject

run!



70
71
72
# File 'lib/merb-auth-more/strategies/multisite/multisite_password_form.rb', line 70

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