Sha256: c751b65a351cce7a127218da780afc0aa463a4a1559311a5c68a887c618563a2

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

class SessionsController < Devise::SessionsController
  def new
    self.resource = resource_class.new(sign_in_params)
    clean_up_passwords(resource)
    render :template => "devise/sessions/new"
  end

  def create
    resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
    if resource.approved?
      sign_in(resource_name, resource)
      respond_with resource, :location => after_sign_in_path_for(resource)
    else
      Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
      set_flash_message :warning, :not_approved
      redirect_to "/login"
    end
  end

  def destroy
    signed_in = signed_in?(resource_name)
    Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
    set_flash_message :notice, :signed_out if signed_in

    respond_to do |format|
      format.any(*navigational_formats) { redirect_to "/login" }
      format.all do
        method = "to_#{request_format}"
        text = {}.respond_to?(method) ? {}.send(method) : ""
        render :text => text, :status => :ok
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.9 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.8 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.7 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.6 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.5 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.4 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.3 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.2 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.1 lib/forge/app/controllers/sessions_controller.rb
forge-cli-0.1.0 lib/forge/app/controllers/sessions_controller.rb