Class: OpenStax::Connect::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- OpenStax::Connect::SessionsController
- Defined in:
- app/controllers/openstax/connect/sessions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#destroy ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 24 def destroy sign_out! # If we're using the Accounts server, need to sign out of it so can't # log back in automagically redirect_to OpenStax::Connect.configuration.enable_stubbing? ? return_url : OpenStax::Utilities.generate_url( OpenStax::Connect.configuration.openstax_accounts_url + "/logout", return_to: return_url ) end |
#failure ⇒ Object
37 38 39 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 37 def failure redirect_to return_url, alert: "Authentication failed, please try again." end |
#new ⇒ Object
7 8 9 10 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 7 def new session[:return_to] ||= request.referrer redirect_to RouteHelper.get_path(:login) end |
#omniauth_authenticated ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 12 def omniauth_authenticated handle_with(SessionsOmniauthAuthenticated, success: lambda { sign_in(@handler_result.outputs[:connect_user_to_sign_in]) # referrer is in Accounts, so don't include it redirect_to return_url }, failure: lambda { failure }) end |