Sha256: 31b5da1ddfdff7c1a391895d9cd18fa1215ed4381a5cdc19b788e79be0302e5f

Contents?: true

Size: 936 Bytes

Versions: 28

Compression:

Stored size: 936 Bytes

Contents

module Workarea
  module Configuration
    module Session
      class NoExpirationConfigured < StandardError; end
      extend self

      def cookie_store?
        return @cookie_store if defined?(@cookie_store)
        @cookie_store = Rails.application.config.session_store == ActionDispatch::Session::CookieStore
      end

      def key
        Rails.application.config.session_options[:key]
      end

      def ttl
        Rails.application.config.session_options[:expire_after]
      end

      def validate!
        if ttl.blank?
          raise(
            NoExpirationConfigured,
            <<~eos

              Problem:
                Workarea requires a session expiration to be set. We recommend 30 minutes.
              Solution:
                Add `expire_after: 30.minutes` to your session configuration in `config/initializers/session_store.rb`
            eos
          )
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.27 lib/workarea/configuration/session.rb
workarea-core-3.5.26 lib/workarea/configuration/session.rb
workarea-core-3.5.25 lib/workarea/configuration/session.rb
workarea-core-3.5.23 lib/workarea/configuration/session.rb
workarea-core-3.5.22 lib/workarea/configuration/session.rb
workarea-core-3.5.21 lib/workarea/configuration/session.rb
workarea-core-3.5.20 lib/workarea/configuration/session.rb
workarea-core-3.5.19 lib/workarea/configuration/session.rb
workarea-core-3.5.18 lib/workarea/configuration/session.rb
workarea-core-3.5.17 lib/workarea/configuration/session.rb
workarea-core-3.5.16 lib/workarea/configuration/session.rb
workarea-core-3.5.15 lib/workarea/configuration/session.rb
workarea-core-3.5.14 lib/workarea/configuration/session.rb
workarea-core-3.5.13 lib/workarea/configuration/session.rb
workarea-core-3.5.12 lib/workarea/configuration/session.rb
workarea-core-3.5.11 lib/workarea/configuration/session.rb
workarea-core-3.5.10 lib/workarea/configuration/session.rb
workarea-core-3.5.9 lib/workarea/configuration/session.rb
workarea-core-3.5.8 lib/workarea/configuration/session.rb
workarea-core-3.5.7 lib/workarea/configuration/session.rb