Class: Session::Check::SessionChecksController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/session/check/session_checks_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.time_of_last_warden_request(session) ⇒ Object



36
37
38
39
40
# File 'app/controllers/session/check/session_checks_controller.rb', line 36

def time_of_last_warden_request(session)
  session['warden.user.user.session']['last_request_at']
rescue => _e
  Time.zone.now
end

Instance Method Details

#time_to_session_expiryObject

Find it there is a session, and if it has any warden information. If so, the user is logged in.



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/session/check/session_checks_controller.rb', line 11

def time_to_session_expiry
  session_exists = false
  session_expires_in = 0
  if current_user
    session_exists = true
    # This calculates how many seconds there are until they are logged out
    session_expires_in = calculate_session_expires_in
  end
  render json: { session_exists: session_exists, session_expires_in: session_expires_in }
end