pax_global_header00006660000000000000000000000064133324145170014515gustar00rootroot0000000000000052 comment=b01a7907c0a42049f25af63c45ec822f55ae8dab recaptcha-4.11.1/000077500000000000000000000000001333241451700135335ustar00rootroot00000000000000recaptcha-4.11.1/.gitignore000066400000000000000000000001021333241451700155140ustar00rootroot00000000000000rdoc pkg .ruby-gemset .ruby-version .bundle .gems .rbenv-gemsets recaptcha-4.11.1/.rubocop.yml000066400000000000000000000047011333241451700160070ustar00rootroot00000000000000AllCops: TargetRubyVersion: 2.3 Include: - 'Rakefile' - 'Gemfile' - 'Rakefile' Exclude: - 'vendor/**/*' - 'demo/**/*' LineLength: Max: 120 ClassLength: Enabled: false Style/StringLiterals: Enabled: false HashSyntax: EnforcedStyle: ruby19 Layout/SpaceInsideHashLiteralBraces: Enabled: false Lint/AmbiguousOperator: Enabled: false Style/Lambda: Enabled: false Style/SpecialGlobalVars: Enabled: false Metrics/MethodLength: Enabled: false Metrics/AbcSize: Enabled: false Style/WordArray: Enabled: false Layout/EndAlignment: EnforcedStyleAlignWith: variable Style/StringLiteralsInInterpolation: Enabled: false Style/NumericLiterals: Enabled: false Layout/FirstParameterIndentation: Enabled: false Layout/IndentHash: Enabled: false Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Layout/MultilineOperationIndentation: Enabled: false Metrics/ModuleLength: Enabled: false Metrics/PerceivedComplexity: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Style/DoubleNegation: Enabled: false Style/Documentation: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Layout/ExtraSpacing: Enabled: false Layout/DotPosition: EnforcedStyle: trailing Style/SingleLineBlockParams: Enabled: false Style/TrailingCommaInArrayLiteral: Enabled: false Style/TrailingCommaInHashLiteral: Enabled: false Style/PerlBackrefs: Enabled: false Style/IfUnlessModifier: Enabled: false # alias / alias_method are both fine Style/Alias: Enabled: false # for simple cases more readable Style/GuardClause: Enabled: false # for single `/` more readable Style/RegexpLiteral: Enabled: false # %w[] shows that it will return an array Style/PercentLiteralDelimiters: PreferredDelimiters: '%i': '[]' '%w': '[]' '%W': '[]' Lint/AssignmentInCondition: Enabled: false Lint/AmbiguousRegexpLiteral: Enabled: false Metrics/ParameterLists: Enabled: false # looks correct / intuitive Lint/ParenthesesAsGroupedExpression: Enabled: false Style/FormatString: Enabled: false Metrics/BlockNesting: Enabled: false Layout/IndentationWidth: Width: 2 Lint/NonLocalExitFromIterator: Enabled: false # often makes logical sense to not combine if with elsif Style/IfInsideElse: Enabled: false Style/FrozenStringLiteralComment: Exclude: - 'test/**/*' Style/SymbolArray: Enabled: false recaptcha-4.11.1/.travis.yml000066400000000000000000000004001333241451700156360ustar00rootroot00000000000000language: ruby cache: bundler sudo: false rvm: - 2.3 - 2.4 - 2.5 env: - TASK=test matrix: include: - rvm: 2.3 # keep same as lowest ruby version env: TASK=rubocop script: bundle exec rake $TASK branches: only: master matrix: fast_finish: true recaptcha-4.11.1/CHANGELOG.md000066400000000000000000000046071333241451700153530ustar00rootroot00000000000000## 4.11.0 - 2018-08-06 * prefer RAILS_ENV over RACK_ENV #286 ## 4.0.0 - 2016-11-14 * public_key -> site_key and private_key -> secret_key ## 3.4.0 - 2016-11-01 * Update fallback html ## 3.2.0 - 2016-06-13 * remove SKIP_VERIFY_ENV constant, use `skip_verify_env` instance variable instead ## 3.1.0 - 2016-06-10 * better error messages * frozen constants ## 3.0.0 - 2016-05-27 * remove all non-ssl options ## 2.3.0 - 2016-05-25 * enable ssl verification by default ... disable via `disable_ssl_verification = true` ## 2.2.0 - 2016-05-23 * Add global hostname validator config * Clean up after with_configuration exception ## 2.1.0 - 2016-05-19 * do not query google if repactcha was not submitted ## 2.0.0 - 2016-05-17 * remove stoken support, must use custom domain verification or domain whitelist ## 1.3.0 - 2016-04-07 * do not set model error and flash ## 1.2.0 - 2016-04-01 * custom domain validation ## 1.1.0 - 2016-01-27 * support RACK_ENV ## 1.0.2 - 2015-11-30 * nice deprecations for api_version ## 1.0.1 - 2015-11-30 * no longer defines `Rails` when `recaptcha/rails` is required ## 1.0.0 - 2015-11-30 * remove api v1 support * remove ssl_api_server_url, nonssl_api_server_url, change api_server_url to always need ssl option * removed activesupport dependency for .to_query * made flash and models both have descriptive errors ## 0.6.0 - 2015-11-19 * extract token module * need to use `gem "recaptcha", require: "recaptcha/rails"` to get rails helpers installed ## 0.5.0 - 2015-11-18 * size option * support disabling stoken * support Rails.env ## 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-4.11.1/Gemfile000066400000000000000000000001061333241451700150230ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' gemspec recaptcha-4.11.1/Gemfile.lock000066400000000000000000000031721333241451700157600ustar00rootroot00000000000000PATH remote: . specs: recaptcha (4.11.1) json GEM remote: https://rubygems.org/ specs: activesupport (5.2.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) ast (2.4.0) bump (0.6.1) byebug (10.0.2) coderay (1.1.2) concurrent-ruby (1.0.5) crack (0.4.3) safe_yaml (~> 1.0.0) hashdiff (0.3.7) i18n (1.0.1) concurrent-ruby (~> 1.0) jaro_winkler (1.5.1) json (2.1.0) maxitest (3.1.0) minitest (>= 5.0.0, < 5.12.0) metaclass (0.0.4) method_source (0.9.0) minitest (5.11.3) mocha (1.5.0) metaclass (~> 0.0.1) parallel (1.12.1) parser (2.5.1.0) ast (~> 2.4.0) powerpack (0.1.2) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) public_suffix (3.0.2) rainbow (3.0.0) rake (12.3.1) rubocop (0.57.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) safe_yaml (1.0.4) thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) unicode-display_width (1.4.0) webmock (3.4.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff PLATFORMS ruby DEPENDENCIES activesupport bump i18n maxitest mocha pry-byebug rake recaptcha! rubocop webmock BUNDLED WITH 1.16.1 recaptcha-4.11.1/LICENSE000066400000000000000000000020401333241451700145340ustar00rootroot00000000000000Copyright (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-4.11.1/README.md000066400000000000000000000217511333241451700150200ustar00rootroot00000000000000# reCAPTCHA Author: Jason L Perry (http://ambethia.com)
Copyright: Copyright (c) 2007-2013 Jason L Perry
License: [MIT](http://creativecommons.org/licenses/MIT/)
Info: https://github.com/ambethia/recaptcha
Bugs: https://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. ## Rails Installation [obtain a reCAPTCHA API key](https://www.google.com/recaptcha/admin). Note: Use localhost or 127.0.0.1 in domain if using localhost:3000. ```Ruby gem "recaptcha" ``` Keep keys out of the code base with environment variables.
Set in production and locally use [dotenv](https://github.com/bkeepers/dotenv), make sure to add it above recaptcha. Otherwise see [Alternative API key setup](#alternative-api-key-setup). ``` export RECAPTCHA_SITE_KEY = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy' export RECAPTCHA_SECRET_KEY = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx' ``` Add `recaptcha_tags` to the forms you want to protect. ```Erb <%= form_for @foo do |f| %> # ... other tags <%= recaptcha_tags %> # ... other tags <% end %> ``` And, add `verify_recaptcha` logic to each form action that you've protected. ```Ruby # app/controllers/users_controller.rb @user = User.new(params[:user].permit(:name)) if verify_recaptcha(model: @user) && @user.save redirect_to @user else render 'new' end ``` ## Sinatra / Rack / Ruby installation See [sinatra demo](/demo/sinatra) for details. - add `gem 'recaptcha'` to `Gemfile` - set env variables - `include Recaptcha::ClientHelper` where you need `recaptcha_tags` - `include Recaptcha::Verify` where you need `verify_recaptcha` ## recaptcha_tags Some of the options available: | Option | Description | |-------------------|-------------| | :noscript | Include