Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enable new relic again. Add blacklisted IPs, prevent user signup from…

… those ranges.
  • Loading branch information...
commit 25e868398467f475c6e6d52f1291f8387167a930 1 parent aa2411e
@sudara authored
View
3  app/controllers/application_controller.rb
@@ -1,6 +1,9 @@
class ApplicationController < ActionController::Base
helper :all # all helpers, all the time
+ @@bad_ip_ranges = ['195.239', '220.181', '61.135', '60.28.232', '121.14', '221.194','117.41.183',
+ '117.41.184','60.169.78','222.186','61.160.232','22.186.24.','127.0.0.1']
+
protect_from_forgery
include AuthenticatedSystem
View
1  app/controllers/assets_controller.rb
@@ -13,7 +13,6 @@ class AssetsController < ApplicationController
# cfnetwork = Safari on osx 10.4 *only* when it tries to download
@@valid_listeners = ['msie','webkit','quicktime','gecko','mozilla','netscape','itunes','chrome','opera', 'safari','cfnetwork','facebookexternalhit','ipad','iphone','apple']
@@bots = ['bot','spider','baidu']
- @@bad_ip_ranges = ['195.239', '220.181', '61.135', '60.28.232', '121.14', '221.194']
# GET /assets
View
1  app/controllers/users_controller.rb
@@ -91,6 +91,7 @@ def new
def create
respond_to do |format|
format.html do
+ return false if @@bad_ip_ranges.any?{|cloaked_ip| request.ip.match /^#{cloaked_ip}/ } # check bad ips
@user = params[:user].blank? ? User.find_by_email(params[:email]) : User.new(params[:user])
if params[:email] and not @user
flash[:error] = "I could not find an account with the email address '#{CGI.escapeHTML params[:email].first}'. <br/> Did you make a boo-boo or have another email I could diligently try for you?"
View
2  config/initializers/setup.rb
@@ -16,6 +16,7 @@
require 'goodies'
require 'utils'
require 'asset_hacks'
+require 'newrelic_rpm'
# require s3 and the s3 expires hack
#require 'aws/s3'
@@ -64,3 +65,4 @@
# various geocoders. Make sure you read up on relevant Terms of Use for each
# geocoder you are going to use.
GeoKit::Geocoders::provider_order = [:google]
+
Please sign in to comment.
Something went wrong with that request. Please try again.