Sha256: 4555a0a1b7e74722b1ebce4b28f245823f120b801f6f9be299b619ebe3892120

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

module Warden::Mixins::Common
  def request
    @request ||= ActionDispatch::Request.new(env)
  end

  # This is called internally by Warden on logout
  def reset_session!
    request.reset_session
  end

  def cookies
    request.cookie_jar
  end
end

class Warden::SessionSerializer
  def serialize(record)
    klass = record.class
    array = klass.serialize_into_session(record)
    array.unshift(klass.name)
  end

  def deserialize(keys)
    klass_name, *args = keys

    begin
      klass = ActiveSupport::Inflector.constantize(klass_name)
      if klass.respond_to? :serialize_from_session
        klass.serialize_from_session(*args)
      else
        Rails.logger.warn "[Devise] Stored serialized class #{klass_name} seems not to be Devise enabled anymore. Did you do that on purpose?"
        nil
      end
    rescue NameError => e
      if e.message =~ /uninitialized constant/
        Rails.logger.debug "[Devise] Trying to deserialize invalid class #{klass_name}"
        nil
      else
        raise
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 6 rubygems

Version Path
devise-2.1.4 lib/devise/rails/warden_compat.rb
devise-warbler-2.2.3 lib/devise/rails/warden_compat.rb
devise-2.2.3 lib/devise/rails/warden_compat.rb
devise-2.1.3 lib/devise/rails/warden_compat.rb
devise-2.2.2 lib/devise/rails/warden_compat.rb
devise-2.2.1 lib/devise/rails/warden_compat.rb
devise-2.2.0 lib/devise/rails/warden_compat.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/devise-2.2.0.rc/lib/devise/rails/warden_compat.rb
devise-2.2.0.rc lib/devise/rails/warden_compat.rb
af-devise-2.1.2 lib/devise/rails/warden_compat.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/rails/warden_compat.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/rails/warden_compat.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/rails/warden_compat.rb
devise-2.1.2 lib/devise/rails/warden_compat.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/rails/warden_compat.rb
rmello-devise-2.1.0.2 lib/devise/rails/warden_compat.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/lib/devise/rails/warden_compat.rb
devise-2.1.0 lib/devise/rails/warden_compat.rb
devise-2.1.0.rc2 lib/devise/rails/warden_compat.rb
upstream-devise-2.1.0.rc lib/devise/rails/warden_compat.rb