diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-04-14 17:11:37 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-04-14 17:11:37 +0100 |
commit | 4e74160d372fd4bca170c056944708b7cfdd2dba (patch) | |
tree | bb5883e1daf7be47e717db3a88802fe4bf3876eb /app/controllers/application_controller.rb | |
parent | eeddc8f46a9583782ee8185de395499d99a5d12a (diff) | |
parent | 8d3b3044fb4a606b76a03abbb71064bcb4875704 (diff) |
Merge branch 'issues/1343-ip-spoofing-error' into rails-3-develop
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ba086cfa3..78a82316a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -432,7 +432,11 @@ class ApplicationController < ActionController::Base def country_from_ip country = "" if !AlaveteliConfiguration::gaze_url.empty? - country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") + begin + country = quietly_try_to_open("#{AlaveteliConfiguration::gaze_url}/gaze-rest?f=get_country_from_ip;ip=#{request.remote_ip}") + rescue ActionDispatch::RemoteIp::IpSpoofAttackError + country = AlaveteliConfiguration::iso_country_code + end end country = AlaveteliConfiguration::iso_country_code if country.empty? return country |