Sha256: fa382aaab8251ecdd2383b575527e1c297c7296941c8f878220b14597459edab

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

Stored size: 816 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
      sign_in_and_redirect(resource_name)
    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_and_redirect(resource_name)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-0.5.5 app/controllers/sessions_controller.rb
devise-0.5.4 app/controllers/sessions_controller.rb