pax_global_header00006660000000000000000000000064125035701540014514gustar00rootroot0000000000000052 comment=688b72ccbea074454b0591ec0aefed3448c37df1 recaptcha-0.4.0/000077500000000000000000000000001250357015400134475ustar00rootroot00000000000000recaptcha-0.4.0/.gitignore000066400000000000000000000001021250357015400154300ustar00rootroot00000000000000rdoc pkg .ruby-gemset .ruby-version .bundle .gems .rbenv-gemsets recaptcha-0.4.0/.travis.yml000066400000000000000000000000361250357015400155570ustar00rootroot00000000000000language: ruby rvm: - 2.1.2 recaptcha-0.4.0/CHANGELOG000066400000000000000000000015431250357015400146640ustar00rootroot00000000000000== 0.3.6 / 2012-01-07 * Many documentation changes * Fixed deprecations in dependencies * Protocol relative JS includes * Fixes for options hash * Fixes for failing tests == 0.3.5 / 2012-05-02 * I18n for error messages * Rails: delete flash keys if unused == 0.3.4 / 2011-12-13 * Rails 3 * Remove jeweler == 0.2.2 / 2009-09-14 * Add a timeout to the validator * Give the documentation some love == 0.2.1 / 2009-09-14 * Removed Ambethia namespace, and restructured classes a bit * Added an example rails app in the example-rails branch == 0.2.0 / 2009-09-12 * RecaptchaOptions AJAX API Fix * Added 'cucumber' as a test environment to skip * Ruby 1.9 compat fixes * Added option :message => 'Custom error message' to verify_recaptcha * Removed dependency on ActiveRecord constant * Add I18n == 0.1.0 / 2008-2-8 * 1 major enhancement * Initial Gem Release recaptcha-0.4.0/Gemfile000066400000000000000000000000471250357015400147430ustar00rootroot00000000000000source 'https://rubygems.org' gemspec recaptcha-0.4.0/Gemfile.lock000066400000000000000000000016701250357015400156750ustar00rootroot00000000000000PATH remote: . specs: recaptcha (0.4.0) GEM remote: https://rubygems.org/ specs: activesupport (4.1.8) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) byebug (3.5.1) columnize (~> 0.8) debugger-linecache (~> 1.2) slop (~> 3.6) coderay (1.1.0) columnize (0.8.9) debugger-linecache (1.2.0) i18n (0.6.11) json (1.8.1) metaclass (0.0.4) method_source (0.8.2) minitest (5.4.3) mocha (1.1.0) metaclass (~> 0.0.1) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) pry-byebug (2.0.0) byebug (~> 3.4) pry (~> 0.10) rake (10.3.2) slop (3.6.0) thread_safe (0.3.4) tzinfo (1.2.2) thread_safe (~> 0.1) PLATFORMS ruby DEPENDENCIES activesupport i18n minitest (~> 5.0) mocha pry-byebug rake recaptcha! recaptcha-0.4.0/LICENSE000066400000000000000000000020401250357015400144500ustar00rootroot00000000000000Copyright (c) 2007 Jason L Perry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.recaptcha-0.4.0/README.rdoc000066400000000000000000000136551250357015400152670ustar00rootroot00000000000000= reCAPTCHA Author:: Jason L Perry (http://ambethia.com) Copyright:: Copyright (c) 2007-2013 Jason L Perry License:: {MIT}[http://creativecommons.org/licenses/MIT/] Info:: http://github.com/ambethia/recaptcha Bugs:: http://github.com/ambethia/recaptcha/issues This plugin adds helpers for the {reCAPTCHA API}[https://www.google.com/recaptcha]. In your views you can use the +recaptcha_tags+ method to embed the needed javascript, and you can validate in your controllers with +verify_recaptcha+ or +verify_recaptcha!+, which throws an error on failiure. Beforehand you need to configure Recaptcha with your custom private and public key. You may find detailed examples below. Exceptions will be raised if you call these methods and the keys can't be found. == Rails Installation reCAPTCHA for Rails > 3.0, add this to your Gemfile: gem "recaptcha", :require => "recaptcha/rails" Rails apps below 3.0 are no longer supported, but you can install an older release and view it's README. == Setting up your API Keys There are multiple ways to setup your reCAPTCHA API key once you {obtain}[https://www.google.com/recaptcha/admin] a pair. === Recaptcha.configure You may use the block style configuration. The following code could be placed into a +config/initializers/recaptcha.rb+ when used in a Rails project. Recaptcha.configure do |config| config.public_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy' config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx' # Uncomment the following line if you are using a proxy server: # config.proxy = 'http://myproxy.com.au:8080' # Uncomment if you want to use the newer version of the API, # only works for versions >= 0.3.7: # config.api_version = 'v2' end This way, you may also set additional options to fit recaptcha into your deployment environment. == Recaptcha#with_configuration If you want to temporarily overwrite the configuration you set with `Recaptcha.configure` (when testing, for example), you can use a `Recaptcha#with_configuration` block: Recaptcha.with_configuration(:public_key => '12345') do # Do stuff with the overwritten public_key. end === Heroku & Shell environment Or, you can keep your keys out of your code base by exporting the following environment variables. You might do this in the .profile/rc, or equivalent for the user running your application. This would also be the preffered method in an Heroku deployment. export RECAPTCHA_PUBLIC_KEY = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy' export RECAPTCHA_PRIVATE_KEY = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx' === Per call You can also pass in your keys as options at runtime, for example: recaptcha_tags :public_key => '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy' and later, verify_recaptcha :private_key => '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx' This option might be useful, if the same code base is used for multiple reCAPTCHA setups. == To use 'recaptcha' Add +recaptcha_tags+ to each form you want to protect. Place it where you want the recaptcha widget to appear. Example: <%= form_for @foo do |f| %> # ... additional lines truncated for brevity ... <%= recaptcha_tags %> # ... additional lines truncated for brevity ... <% end %> And, add +verify_recaptcha+ logic to each form action that you've protected. === +recaptcha_tags+ Some of the options available: :ssl:: Uses secure http for captcha widget (default +false+, but can be changed by setting +config.use_ssl_by_default+) :noscript:: Include