<commit_before>class BanestoController < ApplicationController

  http_basic_authenticate_with :name => "gateway", :password => <PASSWORD>_CONFIG[:gw_<PASSWORD>]
  
  skip_before_filter :verify_authenticity_token

  def payment_accepted
    campaign = Campaign.find_by_slug(params[:id])
    campaign.credit += (params[:amount] / FaxForRails::TAX)
    campaign.save
  end
end
<commit_msg>no basic auth, protect with ip<commit_after>class BanestoController < ApplicationController

  before_filter :protect_payment_accepted

  skip_before_filter :verify_authenticity_token

  def payment_accepted
    campaign = Campaign.find_by_slug(params[:id])
    campaign.credit += (params[:amount] / FaxForRails::TAX)
    campaign.save
  end

  protected

  def protect_payment_accepted
    ips = ['192.168.3.11']
    unless ips.include? request.remote_ip
      # Check for your subnet stuff here, for example
      # if not request.remote_ip.include?('127.0,0')
      render :text => "You are unauthorized"

      return
    end
  end
end

{'fraction_non_alphanumeric': 0.09152872444011685, 'fraction_numerical': 0.013631937682570594, 'mean_word_length': 4.3264248704663215, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '914363', 'n_tokens_mistral': 337, 'n_tokens_neox': 314, 'n_words': 69}