aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/recaptcha-0.3.1/lib
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/recaptcha-0.3.1/lib')
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha.rb40
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/client_helper.rb42
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb52
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/merb.rb4
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/rails.rb4
-rw-r--r--vendor/gems/recaptcha-0.3.1/lib/recaptcha/verify.rb51
6 files changed, 0 insertions, 193 deletions
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha.rb
deleted file mode 100644
index cb6f039a4..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'recaptcha/configuration'
-require 'recaptcha/client_helper'
-require 'recaptcha/verify'
-
-module Recaptcha
- module VERSION #:nodoc:
- MAJOR = 0
- MINOR = 2
- TINY = 2
- PATCH = 1
-
- STRING = [MAJOR, MINOR, TINY, PATCH].join('.')
- end
-
-
- RECAPTCHA_API_SERVER_URL = 'http://www.google.com/recaptcha/api'
- RECAPTCHA_API_SECURE_SERVER_URL = 'https://www.google.com/recaptcha/api'
- RECAPTCHA_VERIFY_URL = 'http://www.google.com/recaptcha/api/verify'
-
- SKIP_VERIFY_ENV = ['test', 'cucumber']
-
- # Gives access to the current Configuration.
- def self.configuration
- @configuration ||= Configuration.new
- end
-
- # Allows easy setting of multiple configuration options. See Configuration
- # for all available options.
- #--
- # The temp assignment is only used to get a nicer rdoc. Feel free to remove
- # this hack.
- #++
- def self.configure
- config = configuration
- yield(config)
- end
-
- class RecaptchaError < StandardError
- end
-end
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/client_helper.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/client_helper.rb
deleted file mode 100644
index 2d54178e1..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/client_helper.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-module Recaptcha
- module ClientHelper
- # Your public API can be specified in the +options+ hash or preferably
- # using the Configuration.
- def recaptcha_tags(options = {})
- # Default options
- key = options[:public_key] ||= Recaptcha.configuration.public_key
- raise RecaptchaError, "No public key specified." unless key
- error = options[:error] ||= (defined? flash ? flash[:recaptcha_error] : "")
- uri = Recaptcha.configuration.api_server_url(options[:ssl])
- html = ""
- if options[:display]
- html << %{<script type="text/javascript">\n}
- html << %{ var RecaptchaOptions = #{options[:display].to_json};\n}
- html << %{</script>\n}
- end
- if options[:ajax]
- html << %{<div id="dynamic_recaptcha"></div>}
- html << %{<script type="text/javascript" src="#{uri}/js/recaptcha_ajax.js"></script>\n}
- html << %{<script type="text/javascript">\n}
- html << %{ Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha')#{options[:display] ? ',RecaptchaOptions' : ''});}
- html << %{</script>\n}
- else
- html << %{<script type="text/javascript" src="#{uri}/challenge?k=#{key}}
- html << %{#{error ? "&amp;error=#{CGI::escape(error)}" : ""}"></script>\n}
- unless options[:noscript] == false
- html << %{<noscript>\n }
- html << %{<iframe src="#{uri}/noscript?k=#{key}" }
- html << %{height="#{options[:iframe_height] ||= 300}" }
- html << %{width="#{options[:iframe_width] ||= 500}" }
- html << %{style="border:none;"></iframe><br/>\n }
- html << %{<textarea name="recaptcha_challenge_field" }
- html << %{rows="#{options[:textarea_rows] ||= 3}" }
- html << %{cols="#{options[:textarea_cols] ||= 40}"></textarea>\n }
- html << %{<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>}
- html << %{</noscript>\n}
- end
- end
- return html.html_safe
- end # recaptcha_tags
- end # ClientHelper
-end # Recaptcha
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
deleted file mode 100644
index 210470a5b..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/configuration.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-module Recaptcha
- # This class enables detailed configuration of the recaptcha services.
- #
- # By calling
- #
- # Recaptcha.configuration # => instance of Recaptcha::Configuration
- #
- # or
- # Recaptcha.configure do |config|
- # config # => instance of Recaptcha::Configuration
- # end
- #
- # you are able to perform configuration updates.
- #
- # Your are able to customize all attributes listed below. All values have
- # sensitive default and will very likely not need to be changed.
- #
- # Please note that the public and private key for the reCAPTCHA API Access
- # have no useful default value. The keys may be set via the Shell enviroment
- # or using this configuration. Settings within this configuration always take
- # precedence.
- #
- # Setting the keys with this Configuration
- #
- # Recaptcha.configure do |config|
- # config.public_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
- # config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
- # end
- #
- class Configuration
- attr_accessor :nonssl_api_server_url,
- :ssl_api_server_url,
- :verify_url,
- :skip_verify_env,
- :private_key,
- :public_key
-
- def initialize #:nodoc:
- @nonssl_api_server_url = RECAPTCHA_API_SERVER_URL
- @ssl_api_server_url = RECAPTCHA_API_SECURE_SERVER_URL
- @verify_url = RECAPTCHA_VERIFY_URL
- @skip_verify_env = SKIP_VERIFY_ENV
-
- @private_key = ENV['RECAPTCHA_PRIVATE_KEY']
- @public_key = ENV['RECAPTCHA_PUBLIC_KEY']
- end
-
- def api_server_url(ssl = false) #:nodoc:
- ssl ? ssl_api_server_url : nonssl_api_server_url
- end
- end
-end
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/merb.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/merb.rb
deleted file mode 100644
index ed7b1928f..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/merb.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'recaptcha'
-
-Merb::GlobalHelpers.send(:include, Recaptcha::ClientHelper)
-Merb::Controller.send(:include, Recaptcha::Verify)
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/rails.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/rails.rb
deleted file mode 100644
index 08741cfd2..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/rails.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'recaptcha'
-
-ActionView::Base.send(:include, Recaptcha::ClientHelper)
-ActionController::Base.send(:include, Recaptcha::Verify) \ No newline at end of file
diff --git a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/verify.rb b/vendor/gems/recaptcha-0.3.1/lib/recaptcha/verify.rb
deleted file mode 100644
index 733ce31be..000000000
--- a/vendor/gems/recaptcha-0.3.1/lib/recaptcha/verify.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-module Recaptcha
- module Verify
- # Your private API can be specified in the +options+ hash or preferably
- # using the Configuration.
- def verify_recaptcha(options = {})
- if !options.is_a? Hash
- options = {:model => options}
- end
-
- env = options[:env] || ENV['RAILS_ENV']
- return true if Recaptcha.configuration.skip_verify_env.include? env
- model = options[:model]
- attribute = options[:attribute] || :base
- private_key = options[:private_key] || Recaptcha.configuration.private_key
- raise RecaptchaError, "No private key specified." unless private_key
-
- begin
- recaptcha = nil
- Timeout::timeout(options[:timeout] || 3) do
- recaptcha = Net::HTTP.post_form URI.parse(Recaptcha.configuration.verify_url), {
- "privatekey" => private_key,
- "remoteip" => request.remote_ip,
- "challenge" => params[:recaptcha_challenge_field],
- "response" => params[:recaptcha_response_field]
- }
- end
- answer, error = recaptcha.body.split.map { |s| s.chomp }
- unless answer == 'true'
- flash[:recaptcha_error] = error
- if model
- model.valid?
- model.errors.add attribute, options[:message] || "Word verification response is incorrect, please try again."
- end
- return false
- else
- flash[:recaptcha_error] = nil
- return true
- end
- rescue Timeout::Error
- flash[:recaptcha_error] = "recaptcha-not-reachable"
- if model
- model.valid?
- model.errors.add attribute, options[:message] || "Oops, we failed to validate your word verification response. Please try again."
- end
- return false
- rescue Exception => e
- raise RecaptchaError, e.message, e.backtrace
- end
- end # verify_recaptcha
- end # Verify
-end # Recaptcha