Sha256: 5662fcfc5c428c176c43a1d89273265ecb414b21d10bf8dfd1615fa2f32c3978

Contents?: true

Size: 593 Bytes

Versions: 1

Compression:

Stored size: 593 Bytes

Contents

module SwitchUser
  module Provider
    class Devise < Base
      def initialize(controller)
        @controller = controller
        @warden = @controller.warden
      end

      def login(user, scope = nil)
        if SwitchUser.provider.is_a?(Hash) && SwitchUser.provider[:store_sign_in]
          @warden.set_user(user, scope: scope)
        else
          @warden.session_serializer.store(user, scope)
        end
      end

      def logout(scope = nil)
        @warden.logout(scope)
      end

      def current_user(scope = nil)
        @warden.user(scope)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
switch_user-1.5.0 lib/switch_user/provider/devise.rb