Sha256: f8e2f362d0f77b02e06555b66aff4a4dff17ff45b7d157e297c84b3c2353cc26

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

class UserSessionsController < ApplicationController
  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.save
      flash[:notice] = "Login successful!"
      redirect_back_or_default my_account_url
    else
      flash[:notice] = "Invalid login/password."
      render :action => :new
    end
  end
  
  def destroy
    current_user_session.destroy
    flash[:notice] = "Logout successful!"
    redirect_back_or_default login_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
base_rails_app-0.0.1 lib/app/controllers/user_sessions_controller.rb