chore(rubocop): giganto rubocop commit.
muahahahah
This commit is contained in:
@@ -1,80 +1,81 @@
|
||||
source 'https://rubygems.org'
|
||||
# frozen_string_literal: true
|
||||
source "https://rubygems.org"
|
||||
|
||||
#don't upgrade
|
||||
gem 'rails', '5.1.4'
|
||||
gem "rails", "5.1.4"
|
||||
|
||||
ruby '2.4.2'
|
||||
ruby "2.4.2"
|
||||
|
||||
gem 'rake'
|
||||
gem 'rails-perftest'
|
||||
gem 'ruby-prof'
|
||||
gem "rails-perftest"
|
||||
gem "rake"
|
||||
gem "ruby-prof"
|
||||
|
||||
# Bundle edge Rails instead:
|
||||
# gem 'rails', git: 'https://github.com/rails/rails'
|
||||
|
||||
gem 'sqlite3'
|
||||
gem 'foreman'
|
||||
gem 'crack', '0.3.2'
|
||||
gem "crack", "0.3.2"
|
||||
gem "foreman"
|
||||
gem "sqlite3"
|
||||
|
||||
# Pry for Rails, not in dev group in case running via prod/staging @ a training
|
||||
gem 'pry-rails'
|
||||
gem "pry-rails"
|
||||
|
||||
group :development, :mysql do
|
||||
gem 'brakeman'
|
||||
gem 'bundler-audit'
|
||||
gem 'guard-brakeman'
|
||||
gem 'guard-livereload'
|
||||
gem 'guard-rspec'
|
||||
gem 'guard-shell'
|
||||
gem 'pry'
|
||||
gem 'rack-livereload'
|
||||
gem 'rb-fsevent'
|
||||
gem 'travis-lint'
|
||||
gem 'better_errors'
|
||||
gem 'binding_of_caller'
|
||||
gem "better_errors"
|
||||
gem "binding_of_caller"
|
||||
gem "brakeman"
|
||||
gem "bundler-audit"
|
||||
gem "guard-brakeman"
|
||||
gem "guard-livereload"
|
||||
gem "guard-rspec"
|
||||
gem "guard-shell"
|
||||
gem "pry"
|
||||
gem "rack-livereload"
|
||||
gem "rb-fsevent"
|
||||
gem "rubocop-github"
|
||||
gem "travis-lint"
|
||||
end
|
||||
|
||||
gem 'simplecov', :require => false, :group => :test
|
||||
gem "simplecov", require: false, group: :test
|
||||
|
||||
group :development, :test, :mysql do
|
||||
gem 'launchy'
|
||||
gem 'capybara'
|
||||
gem 'database_cleaner'
|
||||
gem 'poltergeist'
|
||||
gem 'rspec-rails'
|
||||
gem 'test-unit'
|
||||
gem "capybara"
|
||||
gem "database_cleaner"
|
||||
gem "launchy"
|
||||
gem "poltergeist"
|
||||
gem "rspec-rails"
|
||||
gem "test-unit"
|
||||
end
|
||||
|
||||
group :mysql do
|
||||
gem 'mysql2'
|
||||
gem "mysql2"
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
gem 'sass-rails'
|
||||
gem 'coffee-rails'
|
||||
gem 'jquery-fileupload-rails'
|
||||
gem 'uglifier'
|
||||
gem 'turbolinks'
|
||||
gem "coffee-rails"
|
||||
gem "jquery-fileupload-rails"
|
||||
gem "sass-rails"
|
||||
gem "turbolinks"
|
||||
gem "uglifier"
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'jquery-rails'
|
||||
gem "jquery-rails"
|
||||
|
||||
# To use ActiveModel has_secure_password
|
||||
gem 'bcrypt'
|
||||
gem "bcrypt"
|
||||
|
||||
# Use unicorn as the app server
|
||||
gem 'unicorn'
|
||||
gem "unicorn"
|
||||
|
||||
# Pow related gem
|
||||
gem 'powder'
|
||||
gem "powder"
|
||||
|
||||
gem 'aruba'
|
||||
gem 'execjs'
|
||||
gem 'therubyracer'
|
||||
gem "aruba"
|
||||
gem "execjs"
|
||||
gem "therubyracer"
|
||||
|
||||
# Add SMTP server support using MailCatcher
|
||||
# NOTE: https://github.com/sj26/mailcatcher#bundler
|
||||
@@ -87,6 +88,6 @@ gem 'therubyracer'
|
||||
#end
|
||||
|
||||
#For Rails 4.2
|
||||
gem 'responders'
|
||||
gem "responders"
|
||||
|
||||
gem "minitest"
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
# A sample Guardfile
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
guard 'brakeman', :run_on_start => true do
|
||||
guard "brakeman", run_on_start: true do
|
||||
watch(%r{^app/.+\.(erb|haml|rhtml|rb)$})
|
||||
watch(%r{^config/.+\.rb$})
|
||||
watch(%r{^lib/.+\.rb$})
|
||||
watch('Gemfile')
|
||||
watch("Gemfile")
|
||||
end
|
||||
|
||||
guard :shell do
|
||||
watch(%r{^Gemfile|Gemfile.lock$}) { system("bundle-audit")}
|
||||
watch(%r{^Gemfile|Gemfile.lock$}) { system("bundle-audit")}
|
||||
end
|
||||
|
||||
guard 'livereload', host: "railsgoat.dev", port: '35727' do
|
||||
guard "livereload", host: "railsgoat.dev", port: "35727" do
|
||||
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
||||
watch(%r{app/helpers/.+\.rb})
|
||||
watch(%r{public/.+\.(css|js|html)})
|
||||
@@ -22,24 +23,23 @@ guard 'livereload', host: "railsgoat.dev", port: '35727' do
|
||||
end
|
||||
|
||||
|
||||
guard 'rspec' do
|
||||
guard "rspec" do
|
||||
watch(%r{^spec/.+_spec\.rb$})
|
||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
watch("spec/spec_helper.rb") { "spec" }
|
||||
|
||||
# Rails example
|
||||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
||||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
||||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
||||
watch('config/routes.rb') { "spec/routing" }
|
||||
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
||||
watch("config/routes.rb") { "spec/routing" }
|
||||
watch("app/controllers/application_controller.rb") { "spec/controllers" }
|
||||
|
||||
# Capybara features specs
|
||||
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
||||
|
||||
# Turnip features and steps
|
||||
watch(%r{^spec/acceptance/(.+)\.feature$})
|
||||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
||||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" }
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative 'config/application'
|
||||
require_relative "config/application"
|
||||
|
||||
Rails.application.load_tasks
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
class AdminController < ApplicationController
|
||||
before_action :administrative, :if => :admin_param, :except => [:get_user]
|
||||
before_action :administrative, if: :admin_param, except: [:get_user]
|
||||
skip_before_action :has_info
|
||||
|
||||
def dashboard
|
||||
@@ -41,7 +42,7 @@ class AdminController < ApplicationController
|
||||
message = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.json { render :json => { :msg => message ? "success" : "failure"} }
|
||||
format.json { render json: { msg: message ? "success" : "failure"} }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,7 +55,7 @@ class AdminController < ApplicationController
|
||||
message = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.json { render :json => { :msg => message ? "success" : "failure"} }
|
||||
format.json { render json: { msg: message ? "success" : "failure"} }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,6 +67,6 @@ class AdminController < ApplicationController
|
||||
helper_method :custom_fields
|
||||
|
||||
def admin_param
|
||||
params[:admin_id] != '1'
|
||||
params[:admin_id] != "1"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class Api::V1::MobileController < ApplicationController
|
||||
skip_before_action :authenticated
|
||||
before_action :mobile_request?
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class Api::V1::UsersController < ApplicationController
|
||||
skip_before_action :authenticated
|
||||
before_action :valid_api_token
|
||||
@@ -24,7 +25,7 @@ class Api::V1::UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def identify_user(token="")
|
||||
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
|
||||
unescape_token(token)
|
||||
@@ -42,7 +43,7 @@ class Api::V1::UsersController < ApplicationController
|
||||
|
||||
# We had some issues with the token and url encoding...
|
||||
# this is an attempt to normalize the data.
|
||||
def unescape_token(token="")
|
||||
def unescape_token(token = "")
|
||||
@clean_token = CGI::unescape(token)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class ApplicationController < ActionController::Base
|
||||
before_action :authenticated, :has_info, :create_analytic, :mailer_options
|
||||
helper_method :current_user, :is_admin?, :sanitize_font
|
||||
@@ -22,8 +23,8 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def authenticated
|
||||
path = request.fullpath.present? ? root_url(:url => request.fullpath) : root_url
|
||||
redirect_to path and reset_session if not current_user
|
||||
path = request.fullpath.present? ? root_url(url: request.fullpath) : root_url
|
||||
redirect_to path and reset_session if !current_user
|
||||
end
|
||||
|
||||
def is_admin?
|
||||
@@ -31,7 +32,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def administrative
|
||||
if not is_admin?
|
||||
if !is_admin?
|
||||
redirect_to root_url
|
||||
end
|
||||
end
|
||||
@@ -51,7 +52,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def create_analytic
|
||||
Analytics.create({ :ip_address => request.remote_ip, :referrer => request.referrer, :user_agent => request.user_agent})
|
||||
Analytics.create({ ip_address: request.remote_ip, referrer: request.referrer, user_agent: request.user_agent})
|
||||
end
|
||||
|
||||
def sanitize_font(css)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class BenefitFormsController < ApplicationController
|
||||
|
||||
def index
|
||||
@@ -8,9 +9,9 @@ class BenefitFormsController < ApplicationController
|
||||
begin
|
||||
path = params[:name]
|
||||
file = params[:type].constantize.new(path)
|
||||
send_file file, :disposition => 'attachment'
|
||||
send_file file, disposition: "attachment"
|
||||
rescue
|
||||
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
|
||||
|
||||
@@ -22,7 +23,7 @@ class BenefitFormsController < ApplicationController
|
||||
else
|
||||
flash[:error] = "Something went wrong"
|
||||
end
|
||||
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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class DashboardController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class MessagesController < ApplicationController
|
||||
|
||||
def index
|
||||
@@ -7,15 +8,15 @@ class MessagesController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@message = Message.where(:id => params[:id]).first
|
||||
@message = Message.where(id: params[:id]).first
|
||||
end
|
||||
|
||||
def destroy
|
||||
message = Message.where(:id => params[:id]).first
|
||||
message = Message.where(id: params[:id]).first
|
||||
|
||||
if message.destroy
|
||||
flash[:success] = "Your message has been deleted."
|
||||
redirect_to user_messages_path(:user_id => current_user.user_id)
|
||||
redirect_to user_messages_path(user_id: current_user.user_id)
|
||||
else
|
||||
flash[:error] = "Could not delete message."
|
||||
end
|
||||
@@ -24,13 +25,13 @@ class MessagesController < ApplicationController
|
||||
def create
|
||||
if Message.create(message_params)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to user_messages_path(:user_id => current_user.user_id) }
|
||||
format.json { render :json => {:msg => "success"} }
|
||||
format.html { redirect_to user_messages_path(user_id: current_user.user_id) }
|
||||
format.json { render json: {msg: "success"} }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { redirect_to user_messages_path }
|
||||
format.json { render :json => {:msg => "failure"} }
|
||||
format.json { render json: {msg: "failure"} }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class PaidTimeOffController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class PasswordResetsController < ApplicationController
|
||||
skip_before_action :authenticated
|
||||
|
||||
@@ -18,7 +19,7 @@ class PasswordResetsController < ApplicationController
|
||||
def confirm_token
|
||||
if !params[:token].nil? && is_valid?(params[:token])
|
||||
flash[:success] = "Password reset token confirmed! Please create a new password."
|
||||
render :reset_password
|
||||
render "reset_password"
|
||||
else
|
||||
flash[:error] = "Invalid password reset token. Please try again."
|
||||
redirect_to :login
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class PayController < ApplicationController
|
||||
|
||||
def index
|
||||
@@ -6,20 +7,20 @@ class PayController < ApplicationController
|
||||
def update_dd_info
|
||||
msg = false
|
||||
pay = Pay.new(
|
||||
:bank_account_num => params[:bank_account_num],
|
||||
:bank_routing_num => params[:bank_routing_num],
|
||||
:percent_of_deposit => params[:dd_percent]
|
||||
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!
|
||||
respond_to do |format|
|
||||
format.json {render :json => {:msg => msg } }
|
||||
format.json {render json: {msg: msg } }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.json { render :json => {:user => current_user.pay.as_json} }
|
||||
format.json { render json: {user: current_user.pay.as_json} }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +37,7 @@ class PayController < ApplicationController
|
||||
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" }}
|
||||
format.json {render json: {account_num: decrypted || "No Data" }}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class PerformanceController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class RetirementController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class ScheduleController < ApplicationController
|
||||
|
||||
def create
|
||||
@@ -14,7 +15,7 @@ class ScheduleController < ApplicationController
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.json {render :json => {:msg => message ? "success" : "failure" }}
|
||||
format.json {render json: {msg: message ? "success" : "failure" }}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,11 +34,9 @@ class ScheduleController < ApplicationController
|
||||
rescue
|
||||
end
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render :json => jfs.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
format.json { render json: jfs.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -47,8 +46,8 @@ class ScheduleController < ApplicationController
|
||||
begin
|
||||
vals = []
|
||||
return vals if date_array.empty?
|
||||
date_array.split('-').each do |s|
|
||||
date = Date.strptime(s.strip, '%m/%d/%Y')
|
||||
date_array.split("-").each do |s|
|
||||
date = Date.strptime(s.strip, "%m/%d/%Y")
|
||||
vals <<(date)
|
||||
end
|
||||
rescue ArgumentError
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
class SessionsController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
skip_before_action :authenticated, :only => [:new, :create]
|
||||
skip_before_action :authenticated, only: [:new, :create]
|
||||
|
||||
def new
|
||||
@url = params[:url]
|
||||
@@ -17,9 +18,9 @@ class SessionsController < ApplicationController
|
||||
|
||||
if user
|
||||
if params[:remember_me]
|
||||
cookies.permanent[:auth_token] = user.auth_token if User.where(:user_id => user.user_id).exists?
|
||||
cookies.permanent[:auth_token] = user.auth_token if User.where(user_id: user.user_id).exists?
|
||||
else
|
||||
session[:user_id] = user.user_id if User.where(:user_id => user.user_id).exists?
|
||||
session[:user_id] = user.user_id if User.where(user_id: user.user_id).exists?
|
||||
end
|
||||
redirect_to path
|
||||
else
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class TutorialsController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
skip_before_action :authenticated
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
class UsersController < ApplicationController
|
||||
skip_before_action :has_info
|
||||
skip_before_action :authenticated, :only => [:new, :create]
|
||||
skip_before_action :authenticated, only: [:new, :create]
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
@@ -35,12 +36,12 @@ class UsersController < ApplicationController
|
||||
end
|
||||
message = true if user.save!
|
||||
respond_to do |format|
|
||||
format.html { redirect_to user_account_settings_path(:user_id => current_user.user_id) }
|
||||
format.json { render :json => {:msg => message ? "success" : "false "} }
|
||||
format.html { redirect_to user_account_settings_path(user_id: current_user.user_id) }
|
||||
format.json { render json: {msg: message ? "success" : "false "} }
|
||||
end
|
||||
else
|
||||
flash[:error] = "Could not update user!"
|
||||
redirect_to user_account_settings_path(:user_id => current_user.user_id)
|
||||
redirect_to user_account_settings_path(user_id: current_user.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class WorkInfoController < ApplicationController
|
||||
def index
|
||||
@user = User.find_by_user_id(params[:user_id])
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module AdminHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module Api::V1::UsersHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module ApplicationHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module BenefitFormsHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module DashboardHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module MessagesHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module PaidTimeOffHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module PasswordResetsHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module PayHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module PerformanceHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module RetirementHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module ScheduleHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module SessionsHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module TutorialsHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module UsersHelper
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module WorkInfoHelper
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class UserMailer < ActionMailer::Base
|
||||
default from: "noreply@railsgoat.dev"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
class Analytics < ApplicationRecord
|
||||
scope :hits_by_ip, ->(ip,col="*") { select("#{col}").where(:ip_address => ip).order("id DESC")}
|
||||
scope :hits_by_ip, ->(ip, col = "*") { select("#{col}").where(ip_address: ip).order("id DESC")}
|
||||
|
||||
def self.count_by_col(col)
|
||||
calculate(:count, col)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
class Benefits < ApplicationRecord
|
||||
|
||||
def self.save(file, backup=false)
|
||||
def self.save(file, backup = false)
|
||||
data_path = Rails.root.join("public", "data")
|
||||
full_file_name = "#{data_path}/#{file.original_filename}"
|
||||
f = File.open(full_file_name, "wb+")
|
||||
@@ -10,7 +11,7 @@ class Benefits < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.make_backup(file, data_path, full_file_name)
|
||||
if File.exists?(full_file_name)
|
||||
if File.exist?(full_file_name)
|
||||
silence_streams(STDERR) { system("cp #{full_file_name} #{data_path}/bak#{Time.zone.now.to_i}_#{file.original_filename}") }
|
||||
end
|
||||
end
|
||||
@@ -18,7 +19,7 @@ class Benefits < ApplicationRecord
|
||||
def self.silence_streams(*streams)
|
||||
on_hold = streams.collect { |stream| stream.dup }
|
||||
streams.each do |stream|
|
||||
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
||||
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? "NUL:" : "/dev/null")
|
||||
stream.sync = true
|
||||
end
|
||||
yield
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class KeyManagement < ApplicationRecord
|
||||
belongs_to :work_info
|
||||
belongs_to :user
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
class Message < ApplicationRecord
|
||||
belongs_to :user
|
||||
validates_presence_of :creator_id, :receiver_id, :message
|
||||
|
||||
def creator_name
|
||||
if creator = User.where(:user_id => self.creator_id).first
|
||||
if creator = User.where(user_id: self.creator_id).first
|
||||
creator.full_name
|
||||
else
|
||||
"<b>Name unavailable</b>".html_safe
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
class PaidTimeOff < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_many :schedule, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_many :schedule, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
|
||||
def sick_days_remaining
|
||||
self.sick_days_earned - self.sick_days_taken
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class Pay < ApplicationRecord
|
||||
# Associations
|
||||
belongs_to :user
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
class Performance < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
def reviewer_name
|
||||
u = User.find_by_id(self.reviewer)
|
||||
u.full_name if u.respond_to?('fullname')
|
||||
u.full_name if u.respond_to?("fullname")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class Retirement < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class Schedule < ApplicationRecord
|
||||
belongs_to :paid_time_off
|
||||
|
||||
|
||||
+24
-25
@@ -1,46 +1,45 @@
|
||||
require 'encryption'
|
||||
# frozen_string_literal: true
|
||||
require "encryption"
|
||||
|
||||
class User < ApplicationRecord
|
||||
validates :password, :presence => true,
|
||||
:confirmation => true,
|
||||
:length => {:within => 6..40},
|
||||
:on => :create,
|
||||
:if => :password
|
||||
validates :password, presence: true,
|
||||
confirmation: true,
|
||||
length: {within: 6..40},
|
||||
on: :create,
|
||||
if: :password
|
||||
|
||||
validates_presence_of :email
|
||||
validates_uniqueness_of :email
|
||||
validates_format_of :email, :with => /.+@.+\..+/i
|
||||
validates_format_of :email, with: /.+@.+\..+/i
|
||||
attr_accessor :skip_user_id_assign
|
||||
before_save :assign_user_id, :on => :create
|
||||
before_save :assign_user_id, on: :create
|
||||
before_save :hash_password
|
||||
has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_one :work_info, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_many :performance, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_many :messages, :foreign_key => :receiver_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_many :pay, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_one :retirement, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
has_one :paid_time_off, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
has_one :work_info, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
has_many :performance, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
has_many :messages, foreign_key: :receiver_id, primary_key: :user_id, dependent: :destroy
|
||||
has_many :pay, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
before_create { generate_token(:auth_token) }
|
||||
before_create :build_benefits_data
|
||||
|
||||
def build_benefits_data
|
||||
build_retirement(POPULATE_RETIREMENTS.shuffle.first)
|
||||
build_paid_time_off(POPULATE_PAID_TIME_OFF.shuffle.first).schedule.build(POPULATE_SCHEDULE.shuffle.first)
|
||||
build_work_info(POPULATE_WORK_INFO.shuffle.first)
|
||||
build_retirement(POPULATE_RETIREMENTS.sample)
|
||||
build_paid_time_off(POPULATE_PAID_TIME_OFF.sample).schedule.build(POPULATE_SCHEDULE.sample)
|
||||
build_work_info(POPULATE_WORK_INFO.sample)
|
||||
# Uncomment below line to use encrypted SSN(s)
|
||||
#work_info.build_key_management(:iv => SecureRandom.hex(32))
|
||||
performance.build(POPULATE_PERFORMANCE.shuffle.first)
|
||||
performance.build(POPULATE_PERFORMANCE.sample)
|
||||
end
|
||||
|
||||
def full_name
|
||||
"#{self.first_name} #{self.last_name}"
|
||||
end
|
||||
|
||||
=begin
|
||||
# Instead of the entire user object being returned, we can use this to filter.
|
||||
def as_json
|
||||
super(only: [:user_id, :email, :first_name, :last_name])
|
||||
end
|
||||
=end
|
||||
# # Instead of the entire user object being returned, we can use this to filter.
|
||||
# def as_json
|
||||
# super(only: [:user_id, :email, :first_name, :last_name])
|
||||
# end
|
||||
|
||||
private
|
||||
|
||||
@@ -59,7 +58,7 @@ class User < ApplicationRecord
|
||||
def assign_user_id
|
||||
unless @skip_user_id_assign.present? || self.user_id.present?
|
||||
user = User.order("user_id").last
|
||||
uid = if user && user.user_id && !(User.exists?(:user_id => "#{user.user_id.to_i + 1}"))
|
||||
uid = if user && user.user_id && !(User.exists?(user_id: "#{user.user_id.to_i + 1}"))
|
||||
user.user_id.to_i + 1
|
||||
else
|
||||
1
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
class WorkInfo < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_one :key_management, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
has_one :key_management, foreign_key: :user_id, primary_key: :user_id, dependent: :destroy
|
||||
#before_save :encrypt_ssn
|
||||
|
||||
# We should probably use this
|
||||
def last_four
|
||||
"***-**-" << self.decrypt_ssn[-4,4]
|
||||
"***-**-" << self.decrypt_ssn[-4, 4]
|
||||
end
|
||||
|
||||
def encrypt_ssn
|
||||
@@ -36,6 +37,6 @@ class WorkInfo < ApplicationRecord
|
||||
end
|
||||
|
||||
def cipher_type
|
||||
'aes-256-cbc'
|
||||
"aes-256-cbc"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
require ::File.expand_path("../config/environment", __FILE__)
|
||||
run Rails.application
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require File.expand_path('../boot', __FILE__)
|
||||
# frozen_string_literal: true
|
||||
require File.expand_path("../boot", __FILE__)
|
||||
|
||||
require 'rails/all'
|
||||
require "rails/all"
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
@@ -46,12 +47,12 @@ module Railsgoat
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
|
||||
|
||||
# add app/assets/fonts to the asset path
|
||||
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
config.assets.version = "1.0"
|
||||
|
||||
I18n.config.enforce_available_locales = false
|
||||
end
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
|
||||
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
# Load the Rails application.
|
||||
require File.expand_path('../application', __FILE__)
|
||||
require File.expand_path("../application", __FILE__)
|
||||
|
||||
# Initialize the Rails application.
|
||||
Railsgoat::Application.initialize!
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
Railsgoat::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
@@ -30,8 +31,8 @@ Railsgoat::Application.configure do
|
||||
|
||||
# ActionMailer settings for email support
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = { :address => "127.0.0.1", :port => 1025 }
|
||||
config.action_mailer.default_url_options = { :host => "127.0.0.1:3000" }
|
||||
config.action_mailer.smtp_settings = { address: "127.0.0.1", port: 1025 }
|
||||
config.action_mailer.default_url_options = { host: "127.0.0.1:3000" }
|
||||
|
||||
# config.middleware.insert_before(
|
||||
# Rack::Lock, Rack::LiveReload,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
Railsgoat::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
@@ -30,8 +31,8 @@ Railsgoat::Application.configure do
|
||||
|
||||
# ActionMailer settings for email support
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = { :address => "127.0.0.1", :port => 1025 }
|
||||
config.action_mailer.default_url_options = { :host => "127.0.0.1:3000" }
|
||||
config.action_mailer.smtp_settings = { address: "127.0.0.1", port: 1025 }
|
||||
config.action_mailer.default_url_options = { host: "127.0.0.1:3000" }
|
||||
|
||||
# config.middleware.insert_before(
|
||||
# Rack::Lock, Rack::LiveReload,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
Railsgoat::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
@@ -31,7 +32,7 @@ Railsgoat::Application.configure do
|
||||
config.assets.digest = true
|
||||
|
||||
# For Rails 4.0+: Version of your assets, change this if you want to expire all your assets.
|
||||
config.assets.version = '1.0'
|
||||
config.assets.version = "1.0"
|
||||
|
||||
# Defaults to nil and saved in location specified by config.assets.prefix
|
||||
# config.assets.manifest = YOUR_PATH
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
Railsgoat::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
@@ -9,7 +10,7 @@ Railsgoat::Application.configure do
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
||||
config.public_file_server.headers = { "Cache-Control" => "public, max-age=3600" }
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
# frozen_string_literal: true
|
||||
Rails.application.config.assets.precompile += %w( validation.js jquery.dataTables.min.js fullcalendar.min.js moment.min.js )
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
ACCESS_TOKEN_SALT = "S4828341189aefiasd#ASDF"
|
||||
|
||||
RG_IV = "PPKLKAJDKGHALDJL482823458028"
|
||||
RG_IV = "PPKLKAJDKGHALDJL482823458028"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
# frozen_string_literal: true
|
||||
ActiveSupport::JSON::Encoding::escape_html_entities_in_json = false
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
if Rails.env.production?
|
||||
# Specify env variable/location/etc. to retrieve key from
|
||||
else
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
|
||||
@@ -1,163 +1,164 @@
|
||||
|
||||
# frozen_string_literal: true
|
||||
POPULATE_RETIREMENTS = [
|
||||
{
|
||||
:employee_contrib => "1000",
|
||||
:employer_contrib => "2000",
|
||||
:total => "4500"
|
||||
employee_contrib: "1000",
|
||||
employer_contrib: "2000",
|
||||
total: "4500"
|
||||
},
|
||||
{
|
||||
:employee_contrib => "8000",
|
||||
:employer_contrib => "16000",
|
||||
:total => "30000"
|
||||
employee_contrib: "8000",
|
||||
employer_contrib: "16000",
|
||||
total: "30000"
|
||||
},
|
||||
{
|
||||
:employee_contrib => "10000",
|
||||
:employer_contrib => "20000",
|
||||
:total => "40000"
|
||||
employee_contrib: "10000",
|
||||
employer_contrib: "20000",
|
||||
total: "40000"
|
||||
},
|
||||
{
|
||||
:employee_contrib => "3000",
|
||||
:employer_contrib => "6000",
|
||||
:total => "12500"
|
||||
employee_contrib: "3000",
|
||||
employer_contrib: "6000",
|
||||
total: "12500"
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
POPULATE_PAID_TIME_OFF = [
|
||||
{
|
||||
:sick_days_taken => 2,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 5,
|
||||
:pto_earned => 30
|
||||
sick_days_taken: 2,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 5,
|
||||
pto_earned: 30
|
||||
},
|
||||
{
|
||||
:sick_days_taken => 3,
|
||||
:sick_days_earned => 6,
|
||||
:pto_taken => 3,
|
||||
:pto_earned => 20
|
||||
sick_days_taken: 3,
|
||||
sick_days_earned: 6,
|
||||
pto_taken: 3,
|
||||
pto_earned: 20
|
||||
},
|
||||
{
|
||||
:sick_days_taken => 2,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 5,
|
||||
:pto_earned => 30
|
||||
sick_days_taken: 2,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 5,
|
||||
pto_earned: 30
|
||||
},
|
||||
{
|
||||
:sick_days_taken => 1,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 10,
|
||||
:pto_earned => 30
|
||||
sick_days_taken: 1,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 10,
|
||||
pto_earned: 30
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
||||
POPULATE_SCHEDULE = [
|
||||
{
|
||||
:date_begin => Date.new(2014, 7, 30),
|
||||
:date_end => Date.new(2014, 8, 2),
|
||||
:event_type => "pto",
|
||||
:event_desc => "vacation to france",
|
||||
:event_name => "My 2014 Vacation"
|
||||
|
||||
date_begin: Date.new(2014, 7, 30),
|
||||
date_end: Date.new(2014, 8, 2),
|
||||
event_type: "pto",
|
||||
event_desc: "vacation to france",
|
||||
event_name: "My 2014 Vacation"
|
||||
|
||||
},
|
||||
{
|
||||
:date_begin => Date.new(2013, 9, 1),
|
||||
:date_end => Date.new(2013, 9, 12),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Going Home to see folks",
|
||||
:event_name => "Visit Parents"
|
||||
|
||||
date_begin: Date.new(2013, 9, 1),
|
||||
date_end: Date.new(2013, 9, 12),
|
||||
event_type: "pto",
|
||||
event_desc: "Going Home to see folks",
|
||||
event_name: "Visit Parents"
|
||||
|
||||
},
|
||||
{
|
||||
:date_begin => Date.new(2013, 9, 13),
|
||||
:date_end => Date.new(2013, 9, 20),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Taking kids to Grand Canyon",
|
||||
:event_name => "AZ Trip"
|
||||
|
||||
date_begin: Date.new(2013, 9, 13),
|
||||
date_end: Date.new(2013, 9, 20),
|
||||
event_type: "pto",
|
||||
event_desc: "Taking kids to Grand Canyon",
|
||||
event_name: "AZ Trip"
|
||||
|
||||
},
|
||||
{
|
||||
:date_begin => Date.new(2013, 12, 20),
|
||||
:date_end => Date.new(2013, 12, 30),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Xmas Staycation",
|
||||
:event_name => "Christmas Leave"
|
||||
date_begin: Date.new(2013, 12, 20),
|
||||
date_end: Date.new(2013, 12, 30),
|
||||
event_type: "pto",
|
||||
event_desc: "Xmas Staycation",
|
||||
event_name: "Christmas Leave"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
||||
POPULATE_WORK_INFO = [
|
||||
{
|
||||
:income => "$50,000",
|
||||
:bonuses => "$10,000",
|
||||
:years_worked => 2,
|
||||
:SSN => "666-66-6666",
|
||||
:DoB => "01-01-1980"
|
||||
income: "$50,000",
|
||||
bonuses: "$10,000",
|
||||
years_worked: 2,
|
||||
SSN: "666-66-6666",
|
||||
DoB: "01-01-1980"
|
||||
},
|
||||
{
|
||||
:income => "$40,000",
|
||||
:bonuses => "$10,000",
|
||||
:years_worked => 1,
|
||||
:SSN => "777-77-7777",
|
||||
:DoB => "01-01-1979"
|
||||
income: "$40,000",
|
||||
bonuses: "$10,000",
|
||||
years_worked: 1,
|
||||
SSN: "777-77-7777",
|
||||
DoB: "01-01-1979"
|
||||
},
|
||||
{
|
||||
:income => "$60,000",
|
||||
:bonuses => "$12,000",
|
||||
:years_worked => 3,
|
||||
:SSN => "888-88-8888",
|
||||
:DoB => "01-01-1981"
|
||||
income: "$60,000",
|
||||
bonuses: "$12,000",
|
||||
years_worked: 3,
|
||||
SSN: "888-88-8888",
|
||||
DoB: "01-01-1981"
|
||||
},
|
||||
{
|
||||
:income => "$30,000",
|
||||
:bonuses => "7,000",
|
||||
:years_worked => 1,
|
||||
:SSN => "999-99-9999",
|
||||
:DoB => "01-01-1982"
|
||||
}
|
||||
income: "$30,000",
|
||||
bonuses: "7,000",
|
||||
years_worked: 1,
|
||||
SSN: "999-99-9999",
|
||||
DoB: "01-01-1982"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
POPULATE_PERFORMANCE = [
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Great job! You are my hero",
|
||||
:date_submitted => Date.new(2012, 01, 01),
|
||||
:score => 5
|
||||
reviewer: 1,
|
||||
comments: "Great job! You are my hero",
|
||||
date_submitted: Date.new(2012, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Once again, you've done a great job this year. We greatly appreciate your hard work.",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 5
|
||||
reviewer: 1,
|
||||
comments: "Once again, you've done a great job this year. We greatly appreciate your hard work.",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Great worker, great attitude for this newcomer!",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 5
|
||||
reviewer: 1,
|
||||
comments: "Great worker, great attitude for this newcomer!",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.",
|
||||
:date_submitted => Date.new(2011, 01, 01),
|
||||
:score => 4
|
||||
reviewer: 1,
|
||||
comments: "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.",
|
||||
date_submitted: Date.new(2011, 01, 01),
|
||||
score: 4
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.",
|
||||
:date_submitted => Date.new(2012, 01, 01),
|
||||
:score => 5
|
||||
reviewer: 1,
|
||||
comments: "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.",
|
||||
date_submitted: Date.new(2012, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Right out of the gate has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 4
|
||||
reviewer: 1,
|
||||
comments: "Right out of the gate has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 4
|
||||
},
|
||||
{
|
||||
:reviewer => 1,
|
||||
:comments => "Ehh, you are okay, we will let you stay..... barely",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 2
|
||||
reviewer: 1,
|
||||
comments: "Ehh, you are okay, we will let you stay..... barely",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 2
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Railsgoat::Application.config.secret_token = '2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4'
|
||||
Railsgoat::Application.config.secret_key_base = '2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4'
|
||||
Railsgoat::Application.config.secret_token = "2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4"
|
||||
Railsgoat::Application.config.secret_key_base = "2f1d90a26236c3245d96f5606c201a780dc9ca687e5ed82b45e211bb5dc84c1870f61ca9e002dad5dd8a149c9792d8f07f31a9575065cca064bd6af44f8750e4"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Railsgoat::Application.config.session_store :cookie_store, key: '_railsgoat_session', httponly: false
|
||||
Railsgoat::Application.config.session_store :cookie_store, key: "_railsgoat_session", httponly: false
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
# frozen_string_literal: true
|
||||
ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
Railsgoat::Application.routes.draw do
|
||||
|
||||
get "login" => "sessions#new"
|
||||
@@ -78,14 +79,14 @@ Railsgoat::Application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :api, defaults: {format: 'json'} do
|
||||
namespace :api, defaults: {format: "json"} do
|
||||
namespace :v1 do
|
||||
resources :users
|
||||
resources :mobile
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
root :to => "sessions#new"
|
||||
root to: "sessions#new"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :users do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateRetirements < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :retirements do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreatePaidTimeOffs < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :paid_time_offs do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateSchedules < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :schedules do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateWorkInfos < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :work_infos do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreatePerformances < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :performances do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateBenefits < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :benefits do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateMessages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :messages do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class AddEncryptedSsnToWorkInfos < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :work_infos, :encrypted_ssn, :binary
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateKeyManagements < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :key_managements do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class AddAuthTokenToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :auth_token, :string
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreatePays < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :pays do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
class CreateAnalytics < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :analytics do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
|
||||
+178
-177
@@ -1,274 +1,275 @@
|
||||
# frozen_string_literal: true
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rails db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
|
||||
users = [
|
||||
{
|
||||
:email => "admin@metacorp.com",
|
||||
:admin => true,
|
||||
:password => "admin1234",
|
||||
:password_confirmation => "admin1234",
|
||||
:first_name => "Admin",
|
||||
:last_name => "",
|
||||
:user_id =>1
|
||||
email: "admin@metacorp.com",
|
||||
admin: true,
|
||||
password: "admin1234",
|
||||
password_confirmation: "admin1234",
|
||||
first_name: "Admin",
|
||||
last_name: "",
|
||||
user_id: 1
|
||||
},
|
||||
{
|
||||
:email => "jmmastey@metacorp.com",
|
||||
:admin => false,
|
||||
:password => "railsgoat!",
|
||||
:password_confirmation => "railsgoat!",
|
||||
:first_name => "Joseph",
|
||||
:last_name => "Mastey",
|
||||
:user_id => 2
|
||||
email: "jmmastey@metacorp.com",
|
||||
admin: false,
|
||||
password: "railsgoat!",
|
||||
password_confirmation: "railsgoat!",
|
||||
first_name: "Joseph",
|
||||
last_name: "Mastey",
|
||||
user_id: 2
|
||||
},
|
||||
{
|
||||
:email => "jim@metacorp.com",
|
||||
:admin => false,
|
||||
:password => "alohaowasp",
|
||||
:password_confirmation => "alohaowasp",
|
||||
:first_name => "Jim",
|
||||
:last_name => "Manico",
|
||||
:user_id =>3
|
||||
email: "jim@metacorp.com",
|
||||
admin: false,
|
||||
password: "alohaowasp",
|
||||
password_confirmation: "alohaowasp",
|
||||
first_name: "Jim",
|
||||
last_name: "Manico",
|
||||
user_id: 3
|
||||
},
|
||||
{
|
||||
:email => "mike@metacorp.com",
|
||||
:admin => false,
|
||||
:password => "motocross1445",
|
||||
:password_confirmation => "motocross1445",
|
||||
:first_name => "Mike",
|
||||
:last_name => "McCabe",
|
||||
:user_id =>4
|
||||
email: "mike@metacorp.com",
|
||||
admin: false,
|
||||
password: "motocross1445",
|
||||
password_confirmation: "motocross1445",
|
||||
first_name: "Mike",
|
||||
last_name: "McCabe",
|
||||
user_id: 4
|
||||
},
|
||||
{
|
||||
:email => "ken@metacorp.com",
|
||||
:admin => false,
|
||||
:password => "citrusblend",
|
||||
:password_confirmation => "citrusblend",
|
||||
:first_name => "Ken",
|
||||
:last_name => "Johnson",
|
||||
:user_id =>5
|
||||
email: "ken@metacorp.com",
|
||||
admin: false,
|
||||
password: "citrusblend",
|
||||
password_confirmation: "citrusblend",
|
||||
first_name: "Ken",
|
||||
last_name: "Johnson",
|
||||
user_id: 5
|
||||
},
|
||||
{
|
||||
:email => "admin2@metacorp.com",
|
||||
:admin => false,
|
||||
:password => "adminadmin",
|
||||
:password_confirmation => "adminadmin",
|
||||
:first_name => "Admin2",
|
||||
:last_name => "",
|
||||
:user_id =>6
|
||||
email: "admin2@metacorp.com",
|
||||
admin: false,
|
||||
password: "adminadmin",
|
||||
password_confirmation: "adminadmin",
|
||||
first_name: "Admin2",
|
||||
last_name: "",
|
||||
user_id: 6
|
||||
}
|
||||
]
|
||||
|
||||
retirements = [
|
||||
{
|
||||
:user_id => 2,
|
||||
:employee_contrib => "1000",
|
||||
:employer_contrib => "2000",
|
||||
:total => "4500"
|
||||
user_id: 2,
|
||||
employee_contrib: "1000",
|
||||
employer_contrib: "2000",
|
||||
total: "4500"
|
||||
},
|
||||
{
|
||||
:user_id => 3,
|
||||
:employee_contrib => "8000",
|
||||
:employer_contrib => "16000",
|
||||
:total => "30000"
|
||||
user_id: 3,
|
||||
employee_contrib: "8000",
|
||||
employer_contrib: "16000",
|
||||
total: "30000"
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:employee_contrib => "10000",
|
||||
:employer_contrib => "20000",
|
||||
:total => "40000"
|
||||
user_id: 4,
|
||||
employee_contrib: "10000",
|
||||
employer_contrib: "20000",
|
||||
total: "40000"
|
||||
},
|
||||
{
|
||||
:user_id => 5,
|
||||
:employee_contrib => "3000",
|
||||
:employer_contrib => "6000",
|
||||
:total => "12500"
|
||||
user_id: 5,
|
||||
employee_contrib: "3000",
|
||||
employer_contrib: "6000",
|
||||
total: "12500"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
paid_time_off = [
|
||||
{
|
||||
:user_id => 2,
|
||||
:sick_days_taken => 2,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 5,
|
||||
:pto_earned => 30
|
||||
user_id: 2,
|
||||
sick_days_taken: 2,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 5,
|
||||
pto_earned: 30
|
||||
},
|
||||
{
|
||||
:user_id => 3,
|
||||
:sick_days_taken => 3,
|
||||
:sick_days_earned => 6,
|
||||
:pto_taken => 3,
|
||||
:pto_earned => 20
|
||||
user_id: 3,
|
||||
sick_days_taken: 3,
|
||||
sick_days_earned: 6,
|
||||
pto_taken: 3,
|
||||
pto_earned: 20
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:sick_days_taken => 2,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 5,
|
||||
:pto_earned => 30
|
||||
user_id: 4,
|
||||
sick_days_taken: 2,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 5,
|
||||
pto_earned: 30
|
||||
},
|
||||
{
|
||||
:user_id => 5,
|
||||
:sick_days_taken => 1,
|
||||
:sick_days_earned => 5,
|
||||
:pto_taken => 10,
|
||||
:pto_earned => 30
|
||||
user_id: 5,
|
||||
sick_days_taken: 1,
|
||||
sick_days_earned: 5,
|
||||
pto_taken: 10,
|
||||
pto_earned: 30
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
schedule = [
|
||||
{
|
||||
:user_id => 2,
|
||||
:date_begin => Date.new(2014, 7, 30),
|
||||
:date_end => Date.new(2014, 8, 2),
|
||||
:event_type => "pto",
|
||||
:event_desc => "vacation to france",
|
||||
:event_name => "My 2014 Vacation"
|
||||
user_id: 2,
|
||||
date_begin: Date.new(2014, 7, 30),
|
||||
date_end: Date.new(2014, 8, 2),
|
||||
event_type: "pto",
|
||||
event_desc: "vacation to france",
|
||||
event_name: "My 2014 Vacation"
|
||||
|
||||
},
|
||||
{
|
||||
:user_id => 3,
|
||||
:date_begin => Date.new(2013, 9, 1),
|
||||
:date_end => Date.new(2013, 9, 12),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Going Home to see folks",
|
||||
:event_name => "Visit Parents"
|
||||
user_id: 3,
|
||||
date_begin: Date.new(2013, 9, 1),
|
||||
date_end: Date.new(2013, 9, 12),
|
||||
event_type: "pto",
|
||||
event_desc: "Going Home to see folks",
|
||||
event_name: "Visit Parents"
|
||||
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:date_begin => Date.new(2013, 9, 13),
|
||||
:date_end => Date.new(2013, 9, 20),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Taking kids to Grand Canyon",
|
||||
:event_name => "AZ Trip"
|
||||
user_id: 4,
|
||||
date_begin: Date.new(2013, 9, 13),
|
||||
date_end: Date.new(2013, 9, 20),
|
||||
event_type: "pto",
|
||||
event_desc: "Taking kids to Grand Canyon",
|
||||
event_name: "AZ Trip"
|
||||
|
||||
},
|
||||
{
|
||||
:user_id => 5,
|
||||
:date_begin => Date.new(2013, 12, 20),
|
||||
:date_end => Date.new(2013, 12, 30),
|
||||
:event_type => "pto",
|
||||
:event_desc => "Xmas Staycation",
|
||||
:event_name => "Christmas Leave"
|
||||
user_id: 5,
|
||||
date_begin: Date.new(2013, 12, 20),
|
||||
date_end: Date.new(2013, 12, 30),
|
||||
event_type: "pto",
|
||||
event_desc: "Xmas Staycation",
|
||||
event_name: "Christmas Leave"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
work_info = [
|
||||
{
|
||||
:user_id => 2,
|
||||
:income => "$50,000",
|
||||
:bonuses => "$10,000",
|
||||
:years_worked => 2,
|
||||
:SSN => "555-55-5555",
|
||||
:DoB => "01-01-1980"
|
||||
user_id: 2,
|
||||
income: "$50,000",
|
||||
bonuses: "$10,000",
|
||||
years_worked: 2,
|
||||
SSN: "555-55-5555",
|
||||
DoB: "01-01-1980"
|
||||
},
|
||||
{
|
||||
:user_id => 3,
|
||||
:income => "$40,000",
|
||||
:bonuses => "$10,000",
|
||||
:years_worked => 1,
|
||||
:SSN => "333-33-3333",
|
||||
:DoB => "01-01-1979"
|
||||
user_id: 3,
|
||||
income: "$40,000",
|
||||
bonuses: "$10,000",
|
||||
years_worked: 1,
|
||||
SSN: "333-33-3333",
|
||||
DoB: "01-01-1979"
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:income => "$60,000",
|
||||
:bonuses => "$12,000",
|
||||
:years_worked => 3,
|
||||
:SSN => "444-44-4444",
|
||||
:DoB => "01-01-1981"
|
||||
user_id: 4,
|
||||
income: "$60,000",
|
||||
bonuses: "$12,000",
|
||||
years_worked: 3,
|
||||
SSN: "444-44-4444",
|
||||
DoB: "01-01-1981"
|
||||
},
|
||||
{
|
||||
:user_id => 5,
|
||||
:income => "$30,000",
|
||||
:bonuses => "7,000",
|
||||
:years_worked => 1,
|
||||
:SSN => "222-22-2222",
|
||||
:DoB => "01-01-1982"
|
||||
user_id: 5,
|
||||
income: "$30,000",
|
||||
bonuses: "7,000",
|
||||
years_worked: 1,
|
||||
SSN: "222-22-2222",
|
||||
DoB: "01-01-1982"
|
||||
}
|
||||
]
|
||||
|
||||
performance = [
|
||||
{
|
||||
:user_id => 2,
|
||||
:reviewer => 1,
|
||||
:comments => "Great job! You are my hero",
|
||||
:date_submitted => Date.new(2012, 01, 01),
|
||||
:score => 5
|
||||
user_id: 2,
|
||||
reviewer: 1,
|
||||
comments: "Great job! You are my hero",
|
||||
date_submitted: Date.new(2012, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:user_id => 2,
|
||||
:reviewer => 1,
|
||||
:comments => "Once again, you've done a great job this year. We greatly appreciate your hard work.",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 5
|
||||
user_id: 2,
|
||||
reviewer: 1,
|
||||
comments: "Once again, you've done a great job this year. We greatly appreciate your hard work.",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:user_id => 3,
|
||||
:reviewer => 1,
|
||||
:comments => "Great worker, great attitude for this newcomer!",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 5
|
||||
user_id: 3,
|
||||
reviewer: 1,
|
||||
comments: "Great worker, great attitude for this newcomer!",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:reviewer => 1,
|
||||
:comments => "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.",
|
||||
:date_submitted => Date.new(2011, 01, 01),
|
||||
:score => 4
|
||||
user_id: 4,
|
||||
reviewer: 1,
|
||||
comments: "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.",
|
||||
date_submitted: Date.new(2011, 01, 01),
|
||||
score: 4
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:reviewer => 1,
|
||||
:comments => "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.",
|
||||
:date_submitted => Date.new(2012, 01, 01),
|
||||
:score => 5
|
||||
user_id: 4,
|
||||
reviewer: 1,
|
||||
comments: "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.",
|
||||
date_submitted: Date.new(2012, 01, 01),
|
||||
score: 5
|
||||
},
|
||||
{
|
||||
:user_id => 4,
|
||||
:reviewer => 1,
|
||||
:comments => "Right out of the gate, Mike has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 4
|
||||
user_id: 4,
|
||||
reviewer: 1,
|
||||
comments: "Right out of the gate, Mike has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 4
|
||||
},
|
||||
{
|
||||
:user_id => 5,
|
||||
:reviewer => 1,
|
||||
:comments => "Ehh, you are okay, we will let you stay..... barely",
|
||||
:date_submitted => Date.new(2013, 01, 01),
|
||||
:score => 2
|
||||
user_id: 5,
|
||||
reviewer: 1,
|
||||
comments: "Ehh, you are okay, we will let you stay..... barely",
|
||||
date_submitted: Date.new(2013, 01, 01),
|
||||
score: 2
|
||||
}
|
||||
]
|
||||
|
||||
messages = [
|
||||
{
|
||||
:receiver_id => 2,
|
||||
:creator_id => 5,
|
||||
:message => "Your benefits have been updated.",
|
||||
:read => false
|
||||
receiver_id: 2,
|
||||
creator_id: 5,
|
||||
message: "Your benefits have been updated.",
|
||||
read: false
|
||||
},
|
||||
{
|
||||
:receiver_id => 3,
|
||||
:creator_id => 4,
|
||||
:message => "Please update your profile.",
|
||||
:read => false
|
||||
receiver_id: 3,
|
||||
creator_id: 4,
|
||||
message: "Please update your profile.",
|
||||
read: false
|
||||
},
|
||||
{
|
||||
:receiver_id => 4,
|
||||
:creator_id => 3,
|
||||
:message => "Welcome to Railsgoat.",
|
||||
:read => false
|
||||
receiver_id: 4,
|
||||
creator_id: 3,
|
||||
message: "Welcome to Railsgoat.",
|
||||
read: false
|
||||
},
|
||||
{
|
||||
:receiver_id => 5,
|
||||
:creator_id => 2,
|
||||
:message => "Hello friend.",
|
||||
:read => false
|
||||
receiver_id: 5,
|
||||
creator_id: 2,
|
||||
message: "Hello friend.",
|
||||
read: false
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
+5
-4
@@ -1,16 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
module Encryption
|
||||
|
||||
# Added a re-usable encryption routine, shouldn't be an issue!
|
||||
def self.encrypt_sensitive_value(val="")
|
||||
def self.encrypt_sensitive_value(val = "")
|
||||
aes = OpenSSL::Cipher.new(cipher_type)
|
||||
aes.encrypt
|
||||
aes.key = key[0..31]
|
||||
aes.iv = iv[0..15] if iv != nil
|
||||
new_val = aes.update("#{val}") + aes.final
|
||||
Base64.strict_encode64(new_val).encode('utf-8')
|
||||
Base64.strict_encode64(new_val).encode("utf-8")
|
||||
end
|
||||
|
||||
def self.decrypt_sensitive_value(val="")
|
||||
def self.decrypt_sensitive_value(val = "")
|
||||
aes = OpenSSL::Cipher.new(cipher_type)
|
||||
aes.decrypt
|
||||
aes.key = key[0..31]
|
||||
@@ -30,7 +31,7 @@ module Encryption
|
||||
end
|
||||
|
||||
def self.cipher_type
|
||||
'aes-256-cbc'
|
||||
"aes-256-cbc"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
namespace :server do
|
||||
|
||||
|
||||
desc "Start Rails"
|
||||
task :start do
|
||||
pid_file = "tmp/pids/server.pid"
|
||||
if !(File.exists?(pid_file))
|
||||
if !(File.exist?(pid_file))
|
||||
sh("rails s -d")
|
||||
else
|
||||
puts "[+] Server is already running"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
desc "Stop Rails"
|
||||
task :stop do
|
||||
pid_file = "tmp/pids/server.pid"
|
||||
if File.exists?(pid_file)
|
||||
if File.exist?(pid_file)
|
||||
Process.kill("INT", File.read(pid_file).to_i)
|
||||
else
|
||||
puts "[-] Server isn't running"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
desc 'run training tests'
|
||||
# frozen_string_literal: true
|
||||
desc "run training tests"
|
||||
task :training do
|
||||
Rake::Task["spec:vulnerabilities"].invoke
|
||||
end
|
||||
end
|
||||
|
||||
+4
-3
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
require File.expand_path('../../config/boot', __FILE__)
|
||||
require 'rails/commands'
|
||||
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
||||
require File.expand_path("../../config/boot", __FILE__)
|
||||
require "rails/commands"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=begin require 'spec_helper'
|
||||
|
||||
describe Api::V1::UsersController do
|
||||
|
||||
end
|
||||
=end
|
||||
# frozen_string_literal: true
|
||||
# require 'spec_helper'
|
||||
#
|
||||
# describe Api::V1::UsersController do
|
||||
#
|
||||
# end
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
require 'spec_helper'
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper"
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
require 'spec_helper'
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=begin require 'spec_helper'
|
||||
|
||||
describe PayController do
|
||||
|
||||
end
|
||||
=end
|
||||
# frozen_string_literal: true
|
||||
# require 'spec_helper'
|
||||
#
|
||||
# describe PayController do
|
||||
#
|
||||
# end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
=begin require 'spec_helper'
|
||||
|
||||
# frozen_string_literal: true
|
||||
# require 'spec_helper'
|
||||
#
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Api::V1::UsersHelper. For example:
|
||||
#
|
||||
@@ -10,7 +11,6 @@
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe Api::V1::UsersHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
=end
|
||||
# describe Api::V1::UsersHelper do
|
||||
# pending "add some examples to (or delete) #{__FILE__}"
|
||||
# end
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
require 'spec_helper'
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
=begin require 'spec_helper'
|
||||
|
||||
# frozen_string_literal: true
|
||||
# require 'spec_helper'
|
||||
#
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the PasswordResetsHelper. For example:
|
||||
#
|
||||
@@ -10,7 +11,6 @@
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe PasswordResetsHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
=end
|
||||
# describe PasswordResetsHelper do
|
||||
# pending "add some examples to (or delete) #{__FILE__}"
|
||||
# end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
=begin require 'spec_helper'
|
||||
|
||||
# frozen_string_literal: true
|
||||
# require 'spec_helper'
|
||||
#
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the PayHelper. For example:
|
||||
#
|
||||
@@ -10,7 +11,6 @@
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe PayHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
=end
|
||||
# describe PayHelper do
|
||||
# pending "add some examples to (or delete) #{__FILE__}"
|
||||
# end
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
require "spec_helper"
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require 'spec_helper.rb'
|
||||
# frozen_string_literal: true
|
||||
require "spec_helper.rb"
|
||||
|
||||
describe User do
|
||||
before(:all) do
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user