Class: Solidcrud::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Solidcrud::SessionsController
- Defined in:
- app/controllers/solidcrud/sessions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/solidcrud/sessions_controller.rb', line 33 def create case Solidcrud.config.auth_type when :basic_auth handle_basic_auth_login when :custom handle_custom_auth_login when :devise # Devise handles its own login redirect_to solidcrud.root_path, alert: "Use Devise login instead" when :jwt redirect_to solidcrud.root_path, alert: "JWT authentication doesn't use form login" else redirect_to solidcrud.root_path, alert: "Authentication method not implemented" end end |
#destroy ⇒ Object
49 50 51 52 |
# File 'app/controllers/solidcrud/sessions_controller.rb', line 49 def destroy sign_out_solidcrud_user redirect_to solidcrud.root_path, notice: "Successfully signed out" end |
#new ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/solidcrud/sessions_controller.rb', line 6 def new # If user is already signed in, redirect to admin if solidcrud_user_signed_in? redirect_to solidcrud.root_path return end # Only show login form for certain auth types case Solidcrud.config.auth_type when :basic_auth, :custom # Show login form for basic auth and custom auth when :devise # For Devise, redirect to Devise login if not signed in unless devise_user_signed_in? redirect_to new_session_path(Solidcrud.config.devise_scope), alert: "Please login first" return end when :jwt # JWT auth doesn't need a login form - tokens are passed in headers redirect_to solidcrud.root_path, alert: "JWT authentication required. Please include Bearer token in Authorization header." return else redirect_to solidcrud.root_path, alert: "Authentication not configured" return end end |