Sha256: 7c44007954c965a4b16862b25e84b7c16d6095462805b94031b63a173a482518

Contents?: true

Size: 899 Bytes

Versions: 13

Compression:

Stored size: 899 Bytes

Contents

class SessionsController < ApplicationController
  before_filter :destroy_session, :except => :create

  unloadable

  # GET /login
  # GET /sign-in
  def new
    @session = Challah::Session.new(request)
  end

  # POST /login
  # POST /sign-in
  def create
    @session = Challah::Session.new(request, params[:session])
    @session.ip = request.remote_ip

    if @session.save
      redirect_to return_to_path(@session.default_path)
    else
      redirect_to signin_path, :alert => I18n.translate('sessions.create.failed_login')
    end
  end

  # GET /logout
  # GET /sign-out
  def destroy
    redirect_to signin_path
  end

  protected
    def destroy_session
      current_user_session.destroy
    end

    def return_to_path(default_path = '/')
      result = session[:return_to]
      result = nil if result and result == "http://#{request.domain}/"
      result || default_path
    end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/app/controllers/sessions_controller.rb
challah-0.8.2 app/controllers/sessions_controller.rb
challah-0.8.1 app/controllers/sessions_controller.rb
challah-0.8.0 app/controllers/sessions_controller.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/app/controllers/sessions_controller.rb
challah-0.8.0.pre app/controllers/sessions_controller.rb
challah-0.7.1 app/controllers/sessions_controller.rb
challah-0.7.0 app/controllers/sessions_controller.rb
challah-0.7.0.pre2 app/controllers/sessions_controller.rb
challah-0.7.0.pre app/controllers/sessions_controller.rb
challah-0.6.2 app/controllers/sessions_controller.rb
challah-0.6.1 app/controllers/sessions_controller.rb
challah-0.6.0 app/controllers/sessions_controller.rb