remove trump plan

This commit is contained in:
Kyle Drake 2017-07-07 10:51:14 -07:00
parent 3ff6f420a4
commit 7b068b0872
5 changed files with 26 additions and 145 deletions

View file

@ -72,42 +72,10 @@ get '/?' do
@blog_feed_html = SimpleCache.get :blog_feed_html
end
if params[:trumpplan]
flash[:is_trump_plan] = true
end
erb :index, layout: :index_layout
end
def trump_plan_eligible?
trumpplan_path = File.join 'files', 'trumpplan.txt'
ranges = []
if File.exist? trumpplan_path
parsed_ip = IPAddress.parse request.ip
return false if parsed_ip.ipv6? # NOT EXCLUSIVE ENOUGH
File.readlines(trumpplan_path).each do |range|
ranges << IPAddress.parse(range.strip)
end
matched_ip = false
ranges.each do |range|
if range.include? parsed_ip
matched_ip = true
end
end
return matched_ip
end
false
end
get '/welcome' do
if params[:trumpplan] || flash[:is_trump_plan] || trump_plan_eligible?
@is_trump_plan = true
end
require_login
redirect '/' if current_site.supporter?
erb :'welcome', locals: {site: current_site}

View file

@ -15,11 +15,7 @@ end
post '/supporter/update' do
require_login
if params[:plan_type] == 'trumpplan'
plan_type = 'trumpplan'
else
plan_type = 'supporter'
end
plan_type = 'supporter'
if is_special_upgrade
require_admin