okay, finally got a working redirect vuln

This commit is contained in:
Ken Johnson
2013-06-04 11:00:01 -04:00
parent e1dfb8309c
commit ef2b2e8e11
6 changed files with 124 additions and 6 deletions
+6 -5
View File
@@ -4,28 +4,29 @@ class SessionsController < ApplicationController
skip_before_filter :authenticated, :only => [:new, :create]
def new
redirect_to home_dashboard_index_path if current_user
@url = params[:url]
redirect_to home_dashboard_index_path if current_user
end
def create
path = params[:url].present? ? params[:url] : home_dashboard_index_path
begin
# Normalize the email address, why not
user = User.authenticate(params[:email].to_s.downcase, params[:password])
# @url = params[:url]
rescue Exception => e
end
if user
session[:user_id] = user.user_id if User.where(:user_id => user.user_id).exists?
redirect_to home_dashboard_index_path
redirect_to path
else
# Removed this code, just doesn't seem specific enough!
# flash[:error] = "Either your username and password is incorrect"
flash[:error] = e.message
render "new"
end
end
end
def destroy