Sha256: 87c1e6b4f8ec6d676ee2153f611272b3bcdb162c6ae091375e22e1e40409eb6d

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

class SessionsController < ApplicationController
  include Devise::Controllers::Helpers

  before_filter :require_no_authentication, :only => [ :new, :create ]

  # GET /resource/sign_in
  def new
    Devise::FLASH_MESSAGES.each do |message|
      set_now_flash_message :failure, message if params.try(:[], message) == "true"
    end
    build_resource
  end

  # POST /resource/sign_in
  def create
    if authenticate(resource_name)
      set_flash_message :success, :signed_in
      redirect_back_or_to home_or_root_path
    else
      set_now_flash_message :failure, warden.message || :invalid
      build_resource
      render :new
    end
  end

  # GET /resource/sign_out
  def destroy
    set_flash_message :success, :signed_out if signed_in?(resource_name)
    sign_out(resource_name)
    redirect_to root_path
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-0.5.3 app/controllers/sessions_controller.rb