Sha256: 57901a6c7ef979500cc9cf7a77472ffd92530745b297c9578a7a3bd4edd305a9

Contents?: true

Size: 793 Bytes

Versions: 6

Compression:

Stored size: 793 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?

          debug_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

6 entries across 6 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/middlewares/concerns/auth_helpers.rb