Sha256: 5ab8c0d6a02664214cae98459f1444b56fc3aa7855ee0b5034719db8d8656649

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 KB

Contents

class SessionsController < ApplicationController
  prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
  include Devise::Controllers::InternalHelpers

  # GET /resource/sign_in
  def new
    unless flash[:notice].present?
      Devise::FLASH_MESSAGES.each do |message|
        set_now_flash_message :alert, message if params.try(:[], message) == "true"
      end
    end

    build_resource
    render_with_scope :new
  end

  # POST /resource/sign_in
  def create
    if resource = authenticate(resource_name)
      set_flash_message :notice, :signed_in
      sign_in_and_redirect(resource_name, resource, true)
    elsif [:custom, :redirect].include?(warden.result)
      throw :warden, :scope => resource_name
    else
      set_now_flash_message :alert, (warden.message || :invalid)
      clean_up_passwords(build_resource)
      render_with_scope :new
    end
  end

  # GET /resource/sign_out
  def destroy
    set_flash_message :notice, :signed_out if signed_in?(resource_name)
    sign_out_and_redirect(resource_name)
  end

  protected

    def clean_up_passwords(object)
      object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
    end
end

Version data entries

17 entries across 12 versions & 4 rubygems

Version Path
graffititracker_devise-1.0.11 app/controllers/sessions_controller.rb
devise-1.0.11 app/controllers/sessions_controller.rb
devise-1.0.10 app/controllers/sessions_controller.rb
devise_ennder-1.4.1.0.9 test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb
devise_ennder-1.4.1.0.9 app/controllers/sessions_controller.rb
devise_ennder-1.3.1.0.9 test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb
devise_ennder-1.3.1.0.9 app/controllers/sessions_controller.rb
devise_ennder-1.2.1.0.9 app/controllers/sessions_controller.rb
devise_ennder-1.2.1.0.9 test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb
devise_ennder-1.1.1.0.9 app/controllers/sessions_controller.rb
devise_ennder-1.1.1.0.9 test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb
devise_ennder-1.0.1.0.9 test/rails_app/vendor/plugins/devise/app/controllers/sessions_controller.rb
devise_ennder-1.0.1.0.9 app/controllers/sessions_controller.rb
devise-1.0.9 app/controllers/sessions_controller.rb
devise-1.0.8 app/controllers/sessions_controller.rb
ivanvc-devise-1.0.7.1 app/controllers/sessions_controller.rb
devise-1.0.7 app/controllers/sessions_controller.rb