Sha256: 5420e8e03a229e7fdd7454c652cedf9a07828b88a75337a68ac11977f8f38dcf

Contents?: true

Size: 787 Bytes

Versions: 8

Compression:

Stored size: 787 Bytes

Contents

module Locomotive::Steam
  module Middlewares
    module Concerns
      module AuthHelpers

        def authenticated?
          !!env['steam.authenticated_entry']
        end

        def authenticated_entry_type
          request.session[:authenticated_entry_type]
        end

        def store_authenticated(entry)
          type = entry ? entry.content_type.slug : authenticated_entry_type

          request.session[:authenticated_entry_type]  = type.to_s
          request.session[:authenticated_entry_id]    = entry&._id.to_s

          env['steam.authenticated_entry'] = nil if entry.nil?

          log "[Auth] authenticated #{type.to_s.singularize} ##{entry&._id.to_s}"

          liquid_assigns["current_#{type.singularize}"] = entry
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb