Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. # This file is specifically for you to define your strategies
  2. #
  3. # You should declare you strategies directly and/or use
  4. # Merb::Authentication.activate!(:label_of_strategy)
  5. #
  6. # To load and set the order of strategy processing
  7.  
  8. Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true
  9.  
  10. #Merb::Authentication.activate!(:default_password_form)
  11.  
  12. class AuthenticateOnCompany < Merb::Authentication::Strategy
  13. def run!
  14. if params[:login] && params[:password] && params[:company]
  15. user = user_class.authenticate_on_company(params[:login], params[:password], params[:company])
  16. if !user
  17. request.session.authentication.errors.clear!
  18. request.session.authentication.errors.add(:login, "Try again")
  19. end
  20. user
  21. end
  22. end # run!
  23. end
Add Comment
Please, Sign In to add comment