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.6 lib/workarea/configuration/session.rb
workarea-core-3.5.5 lib/workarea/configuration/session.rb
workarea-core-3.5.4 lib/workarea/configuration/session.rb
workarea-core-3.5.3 lib/workarea/configuration/session.rb
workarea-core-3.5.2 lib/workarea/configuration/session.rb
workarea-core-3.5.1 lib/workarea/configuration/session.rb
workarea-core-3.5.0 lib/workarea/configuration/session.rb
workarea-core-3.5.0.beta.1 lib/workarea/configuration/session.rb