Sha256: 29eaf2b2f2b49b1608b196552f173453c6cc2d94b192878cf26b4ab778a5ea44

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 Bytes

Contents

class UserSessionsController < ApplicationController
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => :destroy
  after_filter :set_lockdown_values, :only => :create

  def new
    @user_session = UserSession.new
  end

  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      flash[:notice] = "Login successful!"
      redirect_back_or_default account_url
    else
      render :action => :new
    end
  end

  def destroy
    current_user_session.destroy
    reset_lockdown_session
    flash[:notice] = "Logout successful!"
    redirect_back_or_default new_user_session_url
  end

private

  def set_lockdown_values
    if user = @user_session.user
      add_lockdown_session_values(user)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemstreamer-1.2.0 spec/assets/testapp/app/controllers/user_sessions_controller.rb
gemstreamer-1.1.1 spec/assets/testapp/app/controllers/user_sessions_controller.rb
gemstreamer-1.1.0 spec/assets/testapp/app/controllers/user_sessions_controller.rb
gemstreamer-1.0.0 spec/assets/testapp/app/controllers/user_sessions_controller.rb
gemstreamer-0.0.0 spec/assets/testapp/app/controllers/user_sessions_controller.rb