Sha256: 482b0e76a2b287d4a879f58455845e1139b22745c2a7f349d69f36d8a26a8159

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

class UserSessionsController < ApplicationController
  before_filter :prevent_store_location, :only => [:destroy, :create]
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => :destroy
  
  def new
    @user_session = UserSession.new
  end
  
  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.create
      flash[:notice] = "Login successful!"
      redirect_back_or_default(account_url)
    else
      render :action => :new
    end
  end
  
  def destroy
    @user_session.destroy
    flash[:notice] = "Logout successful!"
    redirect_back_or_default(new_user_session_url)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authgasm-0.9.1 test_app/app/controllers/user_sessions_controller.rb
authgasm-0.9.0 test_app/app/controllers/user_sessions_controller.rb