Skip to content

Instantly share code, notes, and snippets.

@rails
Created January 2, 2010 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rails/267595 to your computer and use it in GitHub Desktop.
Save rails/267595 to your computer and use it in GitHub Desktop.
class SessionsController < ApplicationController
skip_before_filter :authorize, :only => [ :new, :create ]
def new
end
def create
if user = User.authenticate(params[:name], params[:password])
session[:user_id] = user.id
redirect_to admin_products_url
else
redirect_to new_session_url, :alert => "Invalid user/password combination"
end
end
def destroy
session[:user_id] = nil
redirect_to new_session_url, :notice => "Logged out"
end
end
# resource :session
@probablymikrobi
Copy link

👀

@probablymikrobi
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment