Class: OauthIm::ClientController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- OauthIm::ClientController
- Defined in:
- app/controllers/oauth_im/client_controller.rb
Instance Method Summary collapse
- #callback ⇒ Object
- #callback_redirect ⇒ Object
- #local_login ⇒ Object
- #local_logout ⇒ Object
- #login ⇒ Object
- #logout ⇒ Object
Instance Method Details
#callback ⇒ Object
13 14 15 16 |
# File 'app/controllers/oauth_im/client_controller.rb', line 13 def callback session[:user_jwt] = user_jwt callback_redirect end |
#callback_redirect ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/oauth_im/client_controller.rb', line 18 def callback_redirect # Fetch the original page the user was on just prior to logging in. # If it's not available, default to the root path. referer_path = session.fetch(:oauth_im_login_referer, '').strip if referer_path.empty? redirect_to main_app.root_path else redirect_to referer_path end end |
#local_login ⇒ Object
41 42 43 44 45 46 |
# File 'app/controllers/oauth_im/client_controller.rb', line 41 def local_login head :forbidden if Rails.env.production? session[:userinfo] = local_login_userinfo redirect_back fallback_location: main_app.root_path end |
#local_logout ⇒ Object
48 49 50 51 52 53 |
# File 'app/controllers/oauth_im/client_controller.rb', line 48 def local_logout head :forbidden if Rails.env.production? reset_session redirect_back fallback_location: main_app.root_path end |
#login ⇒ Object
29 30 31 32 33 34 |
# File 'app/controllers/oauth_im/client_controller.rb', line 29 def login # Set the referer path, if available, so that we can put the user # back on the page they were at before they decided the log in. session[:oauth_im_login_referer] = request.referer redirect_to oauth_client.login_url, allow_other_host: true end |
#logout ⇒ Object
36 37 38 39 |
# File 'app/controllers/oauth_im/client_controller.rb', line 36 def logout reset_session redirect_to oauth_client.logout_url, allow_other_host: true end |