Sha256: 8b763d461210a4d4365e34ab17c5a0d3661061b354b643cfc8baa85a71c93215

Contents?: true

Size: 537 Bytes

Versions: 31

Compression:

Stored size: 537 Bytes

Contents

module BookingSync::Engine::SessionHelpers
  extend ActiveSupport::Concern

  private

  # Automatically resets authorization when the session goes inactive.
  # This is only enabled when the engine is set to embedded mode.
  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
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
bookingsync-engine-0.4.5 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.4.4 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.4.3 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.3.0 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.2.2 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.2.1 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.2.0 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.1.3 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.1.2 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.1.1 lib/bookingsync/engine/session_helpers.rb
bookingsync-engine-0.1.0 lib/bookingsync/engine/session_helpers.rb