.gitignore0100644000000000000000000000002612263007475013313 0ustar00wheelwheel00000000000000rdoc pkg Gemfile.lock CHANGELOG0100644000000000000000000000126612263007475012544 0ustar00wheelwheel00000000000000== 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 Gemfile0100644000000000000000000000004712263007475012621 0ustar00wheelwheel00000000000000source 'https://rubygems.org' gemspec LICENSE0100644000000000000000000000204012263007475012326 0ustar00wheelwheel00000000000000Copyright (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.README.rdoc0100644000000000000000000001323012263007475013132 0ustar00wheelwheel00000000000000= 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}[http://recaptcha.net]. 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+. 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}[http://recaptcha.net/whyrecaptcha.html] 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' config.proxy = 'http://myproxy.com.au:8080' 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