Sha256: 6392cb5c6b30eeb042b6cdec9a143dae6782d191d59b4cd3e9aa444a482485a7

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

class Devise::MasqueradesController < DeviseController
  prepend_before_filter :authenticate_scope!, :only => :masquerade

  def show
    self.resource = resource_class.to_adapter.find_first(:id => params[:id])

    redirect_to(new_user_session_path) and return unless self.resource

    self.resource.masquerade!

    redirect_to("#{after_masquerade_path_for(self.resource)}?#{after_masquerade_param_for(resource)}")
  end

  private

  def authenticate_scope!
    send(:"authenticate_#{resource_name}!", :force => true)
  end

  def after_masquerade_path_for(resource)
    "/"
  end

  def after_masquerade_param_for(resource)
    "#{Devise.masquerade_param}=#{resource.masquerade_key}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_masquerade-0.0.3 app/controllers/devise/masquerades_controller.rb