Class: Shakha::SessionController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Shakha::SessionController
- Defined in:
- app/controllers/shakha/session_controller.rb
Instance Method Summary collapse
Instance Method Details
#check ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/shakha/session_controller.rb', line 16 def check if signed_in? render json: { status: "active" } else render json: { status: "login_required", reason: "no_session" }, status: :unauthorized end end |
#destroy ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/shakha/session_controller.rb', line 27 def destroy current_session&.destroy .delete(:shakha_session_token) render json: { status: "signed_out" } end |
#show ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/controllers/shakha/session_controller.rb', line 7 def show render json: { user_id: current_user&.pairwise_sub, email: current_user&.email, name: current_user&.name, expires_at: current_session&.expires_at&.iso8601 } end |