Skip to content

Instantly share code, notes, and snippets.

@kelhusseiny
Created April 20, 2012 04:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelhusseiny/2426109 to your computer and use it in GitHub Desktop.
Save kelhusseiny/2426109 to your computer and use it in GitHub Desktop.
def login_attempt
authorized_user = User.authenticate(params[:username_or_email],params[:login_password])
if authorized_user
session[:user_id] = authorized_user.id
flash[:notice] = "Wow Welcome again, you logged in as #{authorized_user.username}"
redirect_to(:action => 'home')
else
flash[:notice] = "Invalid Username or Password"
flash[:color]= "invalid"
render "login"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment