Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This file is specifically for you to define your strategies
- #
- # You should declare you strategies directly and/or use
- # Merb::Authentication.activate!(:label_of_strategy)
- #
- # To load and set the order of strategy processing
- Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true
- #Merb::Authentication.activate!(:default_password_form)
- class AuthenticateOnCompany < Merb::Authentication::Strategy
- def run!
- if params[:login] && params[:password] && params[:company]
- user = user_class.authenticate_on_company(params[:login], params[:password], params[:company])
- if !user
- request.session.authentication.errors.clear!
- request.session.authentication.errors.add(:login, "Try again")
- end
- user
- end
- end # run!
- end
Add Comment
Please, Sign In to add comment