Created
January 2, 2010 18:29
-
-
Save rails/267595 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👀