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
Instance Method Details
#become ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 38 def become raise SecurityTransgression unless !Rails.env.production? || current_user.is_administrator? sign_in(User.find(params[:user_id])) redirect_to return_url(true) end |
#destroy ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 21 def destroy sign_out! # If we're using the Services 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_services_url + "/logout", return_to: return_url ) end |
#failure ⇒ Object
34 35 36 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 34 def failure redirect_to return_url, alert: "Authentication failed, please try again." end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 9 def new redirect_to RouteHelper.get_path(:login) end |
#omniauth_authenticated ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/openstax/connect/sessions_controller.rb', line 13 def omniauth_authenticated handle_with(SessionsOmniauthAuthenticated, complete: lambda { sign_in(@handler_result.outputs[:connect_user_to_sign_in]) redirect_to return_url(true) }) end |