removed comments and Fixed Issue #184
This commit is contained in:
@@ -10,8 +10,6 @@ class AdminController < ApplicationController
|
|||||||
fields = "*"
|
fields = "*"
|
||||||
else
|
else
|
||||||
fields = params[:field].map {|k,v| k }.join(",")
|
fields = params[:field].map {|k,v| k }.join(",")
|
||||||
# This seems to be a bit safer
|
|
||||||
#fields = params[:field].map {|k,v| Analytics.parse_field(k) }.join(",")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:ip]
|
if params[:ip]
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ class Api::V1::UsersController < ApplicationController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# We removed the .as_json code from the model, just seemed like extra work.
|
|
||||||
# dunno, maybe useful at a later time?
|
|
||||||
#respond_with @user.admin ? User.all.as_json : @user.as_json
|
|
||||||
respond_with @user.admin ? User.all : @user
|
respond_with @user.admin ? User.all : @user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def administrative
|
def administrative
|
||||||
if not is_admin?
|
if not is_admin?
|
||||||
#reset_session
|
|
||||||
redirect_to root_url
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -57,6 +56,5 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def sanitize_font(css)
|
def sanitize_font(css)
|
||||||
css
|
css
|
||||||
# css if css.match(/\A[0-9]+([\%]|pt)\z/)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,24 +25,4 @@ class BenefitFormsController < ApplicationController
|
|||||||
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
|
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
|
||||||
# More secure version
|
|
||||||
def download
|
|
||||||
file_assoc = {"1" => "Health_n_Stuff.pdf", "2" => "Dental_n_Stuff.pdf"}
|
|
||||||
begin
|
|
||||||
if file_assoc.has_key?(params[:name].to_s)
|
|
||||||
path = Rails.root.join('public', 'docs', file_assoc[params[:name].to_s])
|
|
||||||
if params[:type] == "File"
|
|
||||||
file = params[:type].constantize.new(path)
|
|
||||||
send_file file, :disposition => 'attachment'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
file = Rails.root.join('public', 'docs', "Dental_n_Stuff.pdf")
|
|
||||||
send_file file, :disposition => 'attachment'
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ class MessagesController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
@messages = current_user.messages
|
@messages = current_user.messages
|
||||||
@message = Message.new
|
@message = Message.new
|
||||||
# Blocking code can cause DOS
|
|
||||||
sleep(3)
|
sleep(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class SessionsController < ApplicationController
|
|||||||
begin
|
begin
|
||||||
# Normalize the email address, why not
|
# Normalize the email address, why not
|
||||||
user = User.authenticate(params[:email].to_s.downcase, params[:password])
|
user = User.authenticate(params[:email].to_s.downcase, params[:password])
|
||||||
# @url = params[:url]
|
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24,8 +23,6 @@ class SessionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
redirect_to path
|
redirect_to path
|
||||||
else
|
else
|
||||||
# Removed this code, just doesn't seem specific enough!
|
|
||||||
# flash[:error] = "Either your username and password is incorrect"
|
|
||||||
flash[:error] = e.message
|
flash[:error] = e.message
|
||||||
render "new"
|
render "new"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,13 +25,7 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
message = false
|
message = false
|
||||||
#Safest
|
|
||||||
# user = current_user
|
|
||||||
|
|
||||||
# Still an Insecure DoR vulnerability
|
|
||||||
#user = User.find(:first, :conditions => ["user_id = ?", "#{params[:user][:user_id]}"])
|
|
||||||
|
|
||||||
# user = User.find(:first, :conditions => "user_id = '#{params[:user][:user_id]}'")
|
|
||||||
user = User.where("user_id = '#{params[:user][:user_id]}'").first
|
user = User.where("user_id = '#{params[:user][:user_id]}'").first
|
||||||
if user
|
if user
|
||||||
user.skip_user_id_assign = true
|
user.skip_user_id_assign = true
|
||||||
|
|||||||
@@ -7,14 +7,4 @@ class WorkInfoController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
|
||||||
# More secure version
|
|
||||||
def index
|
|
||||||
@user = current_user
|
|
||||||
if !(@user) || @user.admin
|
|
||||||
flash[:error] = "Apologies, looks like something went wrong"
|
|
||||||
redirect_to home_dashboard_index_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ class Benefits < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
|
||||||
def self.make_backup(file, data_path, full_file_name)
|
|
||||||
FileUtils.cp "#{full_file_name}", "#{data_path}/bak#{Time.zone.now.to_i}_#{file.original_filename}"
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
|
|
||||||
def self.silence_streams(*streams)
|
def self.silence_streams(*streams)
|
||||||
on_hold = streams.collect { |stream| stream.dup }
|
on_hold = streams.collect { |stream| stream.dup }
|
||||||
streams.each do |stream|
|
streams.each do |stream|
|
||||||
|
|||||||
+1
-18
@@ -6,12 +6,7 @@ class User < ActiveRecord::Base
|
|||||||
:length => {:within => 6..40},
|
:length => {:within => 6..40},
|
||||||
:on => :create,
|
:on => :create,
|
||||||
:if => :password
|
:if => :password
|
||||||
=begin
|
|
||||||
validates :password, :presence => true,
|
|
||||||
:confirmation => true,
|
|
||||||
:if => :password,
|
|
||||||
:format => {:with => /\A.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\@\#\$\%\^\&\+\=]).*\z/}
|
|
||||||
=end
|
|
||||||
validates_presence_of :email
|
validates_presence_of :email
|
||||||
validates_uniqueness_of :email
|
validates_uniqueness_of :email
|
||||||
validates_format_of :email, :with => /.+@.+\..+/i
|
validates_format_of :email, :with => /.+@.+\..+/i
|
||||||
@@ -61,18 +56,6 @@ class User < ActiveRecord::Base
|
|||||||
return auth
|
return auth
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
|
||||||
# More secure version, still lacking a decent hashing routine, this is for timing attack prevention
|
|
||||||
def self.authenticate(email, password)
|
|
||||||
user = find_by_email(email) || User.new(:password => "")
|
|
||||||
if Rack::Utils.secure_compare(user.password, Digest::MD5.hexdigest(password))
|
|
||||||
return user
|
|
||||||
else
|
|
||||||
raise "Incorrect username or password"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
=end
|
|
||||||
|
|
||||||
def assign_user_id
|
def assign_user_id
|
||||||
unless @skip_user_id_assign.present? || self.user_id.present?
|
unless @skip_user_id_assign.present? || self.user_id.present?
|
||||||
user = User.order("user_id").last
|
user = User.order("user_id").last
|
||||||
|
|||||||
Reference in New Issue
Block a user