Module: BookingSync::Engine::SessionHelpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/bookingsync/engine/session_helpers.rb

Instance Method Summary collapse

Instance Method Details

#sign_out_if_inactiveObject (private)

Automatically resets authorization when the session goes inactive. This is only enabled when the engine is set to embedded mode.


8
9
10
11
12
13
14
15
16
17
# File 'lib/bookingsync/engine/session_helpers.rb', line 8

def sign_out_if_inactive
  return unless BookingSync::Engine.embedded

  last_visit = session[:_bookingsync_last_visit]
  session[:_bookingsync_last_visit] = Time.now.to_i

  if last_visit && (Time.now.to_i - last_visit > BookingSync::Engine.sign_out_after)
    clear_authorization!
  end
end