Clean up trailing and leading whitespace

This commit is contained in:
James Espinosa
2014-07-05 19:15:32 -05:00
parent 6ea16fbe18
commit 68e6a01743
75 changed files with 499 additions and 499 deletions
+6 -6
View File
@@ -1,8 +1,8 @@
class AdminController < ApplicationController
before_filter :administrative, :if => :admin_param
skip_before_filter :has_info
def dashboard
end
@@ -27,14 +27,14 @@ class AdminController < ApplicationController
@users = User.all
render :partial => "layouts/admin/get_all_users"
end
def get_user
@user = User.find_by_id(params[:admin_id].to_s)
arr = ["true", "false"]
@admin_select = @user.admin ? arr : arr.reverse
render :partial => "layouts/admin/get_user"
end
def update_user
user = User.find_by_id(params[:admin_id])
if user
@@ -48,7 +48,7 @@ class AdminController < ApplicationController
format.json { render :json => { :msg => message ? "success" : "failure"} }
end
end
def delete_user
user = User.find_by_user_id(params[:admin_id])
if user && !(current_user.user_id == user.user_id)
@@ -67,5 +67,5 @@ class AdminController < ApplicationController
def admin_param
params[:admin_id] != '1'
end
end
+12 -12
View File
@@ -1,23 +1,23 @@
class Api::V1::UsersController < ApplicationController
skip_before_filter :authenticated
before_filter :valid_api_token
before_filter :extrapolate_user
respond_to :json
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
end
def show
respond_with @user.as_json
end
private
def valid_api_token
@@ -26,7 +26,7 @@ private
identify_user(token)
end
end
def identify_user(token="")
# We've had issues with URL encoding, etc. causing issues so just to be safe
# we will go ahead and unescape the user's token
@@ -37,21 +37,21 @@ private
(id && hash) ? true : false
check_hash(id, hash) ? true : false
end
def check_hash(id, hash)
digest = OpenSSL::Digest::SHA1.hexdigest("#{ACCESS_TOKEN_SALT}:#{id}")
hash == digest
hash == digest
end
# We had some issues with the token and url encoding...
# this is an attempt to normalize the data.
def unescape_token(token="")
@clean_token = CGI::unescape(token)
end
# Added a method to make it easy to figure out who the user is.
def extrapolate_user
@user = User.find_by_id(@clean_token.split("-").first)
end
end
+1 -1
View File
@@ -10,7 +10,7 @@ class ApplicationController < ActionController::Base
def current_user
@current_user ||= (
User.find_by_auth_token(cookies[:auth_token].to_s) ||
User.find_by_auth_token(cookies[:auth_token].to_s) ||
User.find_by_user_id(session[:user_id].to_s)
)
end
+12 -12
View File
@@ -1,12 +1,12 @@
class BenefitFormsController < ApplicationController
def index
@benefits = Benefits.new
end
def download
begin
begin
path = params[:name]
file = params[:type].constantize.new(path)
send_file file, :disposition => 'attachment'
@@ -14,7 +14,7 @@ class BenefitFormsController < ApplicationController
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
end
end
def upload
file = params[:benefits][:upload]
if file
@@ -22,23 +22,23 @@ class BenefitFormsController < ApplicationController
Benefits.save(file, params[:benefits][:backup])
else
flash[:error] = "Something went wrong"
end
end
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
end
=begin
=begin
# More secure version
def download
file_assoc = {"1" => "Health_n_Stuff.pdf", "2" => "Dental_n_Stuff.pdf"}
begin
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)
file = params[:type].constantize.new(path)
send_file file, :disposition => 'attachment'
end
else
end
else
file = Rails.root.join('public', 'docs', "Dental_n_Stuff.pdf")
send_file file, :disposition => 'attachment'
end
@@ -46,7 +46,7 @@ class BenefitFormsController < ApplicationController
redirect_to user_benefit_forms_path(:user_id => current_user.user_id)
end
end
=end
=end
end
+2 -2
View File
@@ -1,7 +1,7 @@
class DashboardController < ApplicationController
skip_before_filter :has_info
def home
@user = current_user
+1 -1
View File
@@ -1,5 +1,5 @@
class PaidTimeOffController < ApplicationController
def index
@pto = current_user.paid_time_off
@schedule = Schedule.new
+9 -9
View File
@@ -1,28 +1,28 @@
class PayController < ApplicationController
def index
end
def update_dd_info
msg = false
pay = Pay.new(
:bank_account_num => params[:bank_account_num],
:bank_routing_num => params[:bank_routing_num],
:bank_account_num => params[:bank_account_num],
:bank_routing_num => params[:bank_routing_num],
:percent_of_deposit => params[:dd_percent]
)
pay.user_id = current_user.user_id
msg = true if pay.save!
msg = true if pay.save!
respond_to do |format|
format.json {render :json => {:msg => msg } }
end
end
def show
respond_to do |format|
format.json { render :json => {:user => current_user.pay.as_json} }
end
end
def destroy
pay = Pay.find_by_id(params[:id])
if pay.present? and pay.destroy
@@ -32,12 +32,12 @@ class PayController < ApplicationController
end
redirect_to user_pay_index_path
end
def decrypted_bank_acct_num
decrypted = Encryption.decrypt_sensitive_value(params[:value_to_decrypt])
respond_to do |format|
format.json {render :json => {:account_num => decrypted || "No Data" }}
end
end
end
+2 -2
View File
@@ -1,7 +1,7 @@
class PerformanceController < ApplicationController
def index
@perf = current_user.performance
end
end
+2 -2
View File
@@ -1,7 +1,7 @@
class RetirementController < ApplicationController
def index
@info = current_user.retirement
end
end
+9 -9
View File
@@ -1,7 +1,7 @@
class ScheduleController < ApplicationController
def create
message = false
if params[:schedule][:event_type] == "pto"
sched = Schedule.new(params[:schedule])
sched.date_begin, sched.date_end = format_schedule_date(params[:date_range1])
@@ -11,12 +11,12 @@ class ScheduleController < ApplicationController
message = true
end
end
respond_to do |format|
format.json {render :json => {:msg => message ? "success" : "failure" }}
end
end
def get_pto_schedule
begin
schedules = current_user.paid_time_off.schedule
@@ -29,17 +29,17 @@ class ScheduleController < ApplicationController
hash[:end] = s[:date_end]
jfs << hash
end
rescue
rescue
end
respond_to do |format|
format.json do
render :json => jfs.to_json
end
end
end
end
private
# Returns a two part array consisting of dates
# First value is the begin date and the second is the end date
def format_schedule_date(date_array)
@@ -50,10 +50,10 @@ class ScheduleController < ApplicationController
date = Date.strptime(s.strip, '%m/%d/%Y')
vals <<(date)
end
rescue ArgumentError
rescue ArgumentError
return []
end
return vals
end
end
+8 -8
View File
@@ -1,22 +1,22 @@
class SessionsController < ApplicationController
skip_before_filter :has_info
skip_before_filter :authenticated, :only => [:new, :create]
def new
@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
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
if params[:remember_me]
cookies.permanent[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
@@ -26,12 +26,12 @@ class SessionsController < ApplicationController
redirect_to path
else
# Removed this code, just doesn't seem specific enough!
# flash[:error] = "Either your username and password is incorrect"
# flash[:error] = "Either your username and password is incorrect"
flash[:error] = e.message
render "new"
end
end
end
def destroy
cookies.delete(:auth_token)
reset_session
+23 -23
View File
@@ -1,26 +1,26 @@
class TutorialsController < ApplicationController
skip_before_filter :has_info
skip_before_filter :authenticated
def index
end
def credentials
render :partial => "layouts/tutorial/credentials/creds"
end
def show
render "injection"
end
def injection
end
def xss
@code = %{
<li style="color: #FFFFFF">
<!--
<!--
I'm going to use HTML safe because we had some weird stuff
going on with funny chars and jquery, plus it says safe so I'm guessing
nothing bad will happen
@@ -29,13 +29,13 @@ class TutorialsController < ApplicationController
</li>
}
end
def broken_auth
end
def insecure_dor
end
def csrf
@meta_code_bad = %{<%#= csrf_meta_tags %> <!-- <~ What is this for? I hear it helps w/ JS and Sea-surfing.....whatevz -->}
@meta_code_good = %{<%= csrf_meta_tags %> }
@@ -55,10 +55,10 @@ class TutorialsController < ApplicationController
\}
\});
\});
\} }
end
def misconfig
end
@@ -67,33 +67,33 @@ class TutorialsController < ApplicationController
def access_control
end
def crypto
end
def url_access
end
def ssl_tls
end
def redirects
end
def guard
end
def logic_flaws
end
def mass_assignment
end
def guantlt
end
def metaprogramming
end
end
+5 -5
View File
@@ -1,8 +1,8 @@
class WorkInfoController < ApplicationController
def index
@user = User.find_by_user_id(params[:user_id])
if !(@user) || @user.admin
if !(@user) || @user.admin
flash[:error] = "Sorry, no user with that user id exists"
redirect_to home_dashboard_index_path
end
@@ -12,11 +12,11 @@ class WorkInfoController < ApplicationController
# More secure version
def index
@user = current_user
if !(@user) || @user.admin
if !(@user) || @user.admin
flash[:error] = "Apologies, looks like something went wrong"
redirect_to home_dashboard_index_path
end
end
=end
=end
end