Class: OpenStax::Accounts::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- OpenStax::Accounts::SessionsController
- Defined in:
- app/controllers/openstax/accounts/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#callback ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/openstax/accounts/sessions_controller.rb', line 14 def callback handle_with( SessionsCallback, success: lambda { sign_in(@handler_result.outputs[:account]) redirect_back key: :accounts_return_to, strategies: [:session] }, failure: lambda { failure }) end |
#destroy ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/openstax/accounts/sessions_controller.rb', line 26 def destroy sign_out! # If we're using the Accounts server, need to sign out of it so can't # log back in automagically if OpenStax::Accounts.configuration.enable_stubbing? redirect_to main_app.root_url else redirect_to( OpenStax::Utilities.generate_url( OpenStax::Accounts.configuration.openstax_accounts_url, "logout" ) ) end end |
#failure ⇒ Object
42 43 44 45 |
# File 'app/controllers/openstax/accounts/sessions_controller.rb', line 42 def failure redirect_back key: :accounts_return_to, alert: "Authentication failed, please try again." end |
#new ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/controllers/openstax/accounts/sessions_controller.rb', line 5 def new if OpenStax::Accounts.configuration.enable_stubbing? redirect_to dev_accounts_path else store_fallback key: :accounts_return_to, strategies: [:session] redirect_to openstax_login_path end end |
#profile ⇒ Object
47 48 49 50 51 52 |
# File 'app/controllers/openstax/accounts/sessions_controller.rb', line 47 def profile # TODO: stub profile if stubbing is enabled redirect_to(URI.join( OpenStax::Accounts.configuration.openstax_accounts_url, "/profile" ).to_s) end |