* VRFS-746 - add config to read X-Real-IP instead of request.remote_ip

This commit is contained in:
Seth Call 2013-10-01 18:57:02 +00:00
parent 79f458d6d5
commit ea1f6fb17b
6 changed files with 47 additions and 2 deletions

View File

@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
include ApplicationHelper
include SessionsHelper

View File

@ -48,7 +48,7 @@ class SessionsController < ApplicationController
# an email and whatnot.
#
# Also, should we grab their photo from facebook?
user = UserManager.new.signup(request.remote_ip,
user = UserManager.new.signup(remote_ip(),
auth_hash[:info][:first_name],
auth_hash[:info][:last_name],
auth_hash[:info][:email],

View File

@ -30,7 +30,8 @@ class UsersController < ApplicationController
return
end
@signup_postback = load_postback(@invited_user)
load_location(request.remote_ip)
load_location(remote_ip())
@user = User.new
@user.musician = true # default the UI to musician as selected option

View File

@ -18,4 +18,12 @@ module ApplicationHelper
Rails.application.config.bugsnag_notify_release_stages.include? Rails.env
end
def remote_ip
if Rails.application.config.proxy_use_x_real_ip
request.env['X-Real-IP']
else
request.remote_ip
end
end
end

View File

@ -154,5 +154,7 @@ if defined?(Bundler)
config.ga_ua = 'UA-44184562-2' # google analytics
config.ga_suppress_admin = true
config.proxy_use_x_real_ip = false
end
end

View File

@ -0,0 +1,33 @@
require 'spec_helper'
# these test will verify all of the user progression cases that rely on a javascript event (not bothering with instrumented models)
describe "User Progression", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_wait_time = 10
end
let(:user) { FactoryGirl.create(:user) }
before(:each) do
sign_in_poltergeist user
end
describe "downloaded client" do
end
describe "ran client" do
end
describe "social promoted" do
end
end