public
Created

  • Download Gist
sessions_controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.