diff -Nru ruby-recaptcha-0.4.0/CHANGELOG ruby-recaptcha-3.2.0/CHANGELOG --- ruby-recaptcha-0.4.0/CHANGELOG 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/CHANGELOG 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -== 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 diff -Nru ruby-recaptcha-0.4.0/CHANGELOG.md ruby-recaptcha-3.2.0/CHANGELOG.md --- ruby-recaptcha-0.4.0/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/CHANGELOG.md 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,91 @@ +## 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 diff -Nru ruby-recaptcha-0.4.0/debian/changelog ruby-recaptcha-3.2.0/debian/changelog --- ruby-recaptcha-0.4.0/debian/changelog 2015-07-28 18:00:55.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/changelog 2016-07-09 13:45:26.000000000 +0000 @@ -1,3 +1,19 @@ +ruby-recaptcha (3.2.0-2) unstable; urgency=medium + + * Team upload + * Reupload to unstable + * Check gemspec dependencies during build + + -- Pirate Praveen Sat, 09 Jul 2016 18:25:17 +0530 + +ruby-recaptcha (3.2.0-1) experimental; urgency=medium + + * Team upload + * New upstream major release + * Remove patch gemspec_without_git.patch (gem2deb can handle it now) + + -- Pirate Praveen Thu, 16 Jun 2016 16:04:41 +0530 + ruby-recaptcha (0.4.0-1) unstable; urgency=medium * New upstream release: diff -Nru ruby-recaptcha-0.4.0/debian/control ruby-recaptcha-3.2.0/debian/control --- ruby-recaptcha-0.4.0/debian/control 2015-07-28 07:51:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/control 2016-06-16 09:59:14.000000000 +0000 @@ -3,20 +3,20 @@ Priority: optional Maintainer: David Martínez Moreno Build-Depends: debhelper (>= 9), - gem2deb (>= 0.2.6~) -Standards-Version: 3.9.6 + gem2deb +Standards-Version: 3.9.8 Homepage: https://github.com/ambethia/recaptcha/ -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-recaptcha.git -Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-recaptcha.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-recaptcha.git +Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/ruby-recaptcha.git XS-Ruby-Versions: all Package: ruby-recaptcha Architecture: all XB-Ruby-Versions: ${ruby:Versions} -Depends: ${shlibs:Depends}, - ${misc:Depends}, +Depends: rails (>> 4.1), ruby | ruby-interpreter, - rails (>> 4.1) + ${misc:Depends}, + ${shlibs:Depends} Description: Ruby helpers for the reCAPTCHA API This plugin gives a high-level interface for using reCAPTCHA authentication methods in your ruby programs. diff -Nru ruby-recaptcha-0.4.0/debian/patches/gemspec_without_git.patch ruby-recaptcha-3.2.0/debian/patches/gemspec_without_git.patch --- ruby-recaptcha-0.4.0/debian/patches/gemspec_without_git.patch 2015-07-28 07:23:25.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/patches/gemspec_without_git.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Description: Use a gemspec that doesn't depend on git. - The .tar.gz obviously doesn't have a .git and in the pdebuild chroots - we also don't have the git binary. -Author: David Martínez Moreno -Bug-Ubuntu: https://launchpad.net/bugs/1400564 -Forwarded: no -Last-Update: 2015-07-28 - ---- ruby-recaptcha-0.4.0.orig/recaptcha.gemspec -+++ ruby-recaptcha-0.4.0/recaptcha.gemspec -@@ -13,8 +13,8 @@ Gem::Specification.new do |s| - - s.rubyforge_project = "recaptcha" - -- s.files = `git ls-files`.split("\n") -- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") -+ s.files = Dir.glob("lib/**/*") -+ s.test_files = Dir.glob("{test,spec,features}/**/*") - s.require_paths = ["lib"] - - s.add_development_dependency "mocha" diff -Nru ruby-recaptcha-0.4.0/debian/patches/series ruby-recaptcha-3.2.0/debian/patches/series --- ruby-recaptcha-0.4.0/debian/patches/series 2015-07-28 07:49:58.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -gemspec_without_git.patch diff -Nru ruby-recaptcha-0.4.0/debian/ruby-recaptcha.docs ruby-recaptcha-3.2.0/debian/ruby-recaptcha.docs --- ruby-recaptcha-0.4.0/debian/ruby-recaptcha.docs 2015-07-28 06:19:35.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/ruby-recaptcha.docs 2016-06-16 09:58:21.000000000 +0000 @@ -1 +1 @@ -README.rdoc +README.md diff -Nru ruby-recaptcha-0.4.0/debian/rules ruby-recaptcha-3.2.0/debian/rules --- ruby-recaptcha-0.4.0/debian/rules 2015-07-28 06:19:35.000000000 +0000 +++ ruby-recaptcha-3.2.0/debian/rules 2016-07-09 13:45:09.000000000 +0000 @@ -1,12 +1,6 @@ #!/usr/bin/make -f -#export DH_VERBOSE=1 -# -# Uncomment to ignore all test failures (but the tests will run anyway) -#export DH_RUBY_IGNORE_TESTS=all -# -# Uncomment to ignore some test failures (but the tests will run anyway). -# Valid values: -#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems + +export GEM2DEB_TEST_RUNNER = --check-dependencies %: dh $@ --buildsystem=ruby --with ruby diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/assets/javascripts/application.js ruby-recaptcha-3.2.0/demo/rails/app/assets/javascripts/application.js --- ruby-recaptcha-0.4.0/demo/rails/app/assets/javascripts/application.js 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/assets/javascripts/application.js 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,13 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require_tree . diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/assets/stylesheets/application.css ruby-recaptcha-3.2.0/demo/rails/app/assets/stylesheets/application.css --- ruby-recaptcha-0.4.0/demo/rails/app/assets/stylesheets/application.css 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/assets/stylesheets/application.css 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/controllers/application_controller.rb ruby-recaptcha-3.2.0/demo/rails/app/controllers/application_controller.rb --- ruby-recaptcha-0.4.0/demo/rails/app/controllers/application_controller.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/controllers/application_controller.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/controllers/captcha_controller.rb ruby-recaptcha-3.2.0/demo/rails/app/controllers/captcha_controller.rb --- ruby-recaptcha-0.4.0/demo/rails/app/controllers/captcha_controller.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/controllers/captcha_controller.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,12 @@ +class CaptchaController < ApplicationController + def index + end + + def create + if verify_recaptcha + render text: 'YES' + else + render text: 'NO' + end + end +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/controllers/users_controller.rb ruby-recaptcha-3.2.0/demo/rails/app/controllers/users_controller.rb --- ruby-recaptcha-0.4.0/demo/rails/app/controllers/users_controller.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/controllers/users_controller.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,18 @@ +class UsersController < ApplicationController + def index + @users = User.all + end + + def edit + @user = User.find(params[:id]) + end + + def update + @user = User.find(params[:id]) + if verify_recaptcha(model: @user, message: 'Error in passing CAPTCHA.') && @user.save + redirect_to users_path, notice: "Saved" + else + render 'edit' + end + end +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/helpers/application_helper.rb ruby-recaptcha-3.2.0/demo/rails/app/helpers/application_helper.rb --- ruby-recaptcha-0.4.0/demo/rails/app/helpers/application_helper.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/helpers/application_helper.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/models/user.rb ruby-recaptcha-3.2.0/demo/rails/app/models/user.rb --- ruby-recaptcha-0.4.0/demo/rails/app/models/user.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/models/user.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,2 @@ +class User < ActiveRecord::Base +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/views/captcha/index.html.erb ruby-recaptcha-3.2.0/demo/rails/app/views/captcha/index.html.erb --- ruby-recaptcha-0.4.0/demo/rails/app/views/captcha/index.html.erb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/views/captcha/index.html.erb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,46 @@ +<% if params[:multi] %> + + + <%= form_tag "/captchas" do |f| %> +
+ <%= submit_tag %> + <% end %> + <%= form_tag "/captchas" do %> +
+ <%= submit_tag %> + <% end %> + <%= form_tag "/captchas" do %> +
+ <%= submit_tag %> + <% end %> + + <%= link_to 'Single ?', '?' %> +<% else %> + <%= form_tag "/captchas" do %> + <%= recaptcha_tags %> + <%= submit_tag %> + <% end %> + <%= link_to 'Multi ?', '?multi=1' %> +<% end %> diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/views/layouts/application.html.erb ruby-recaptcha-3.2.0/demo/rails/app/views/layouts/application.html.erb --- ruby-recaptcha-0.4.0/demo/rails/app/views/layouts/application.html.erb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/views/layouts/application.html.erb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,18 @@ + + + + Foo + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<% flash.each do |k,v| %> +
<%= k %>: <%= v %>
+<% end %> + +<%= yield %> + + + diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/views/users/edit.html.erb ruby-recaptcha-3.2.0/demo/rails/app/views/users/edit.html.erb --- ruby-recaptcha-0.4.0/demo/rails/app/views/users/edit.html.erb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/views/users/edit.html.erb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,5 @@ +<%= form_for @user do |f| %> + <%= f.text_field :name %> + <%= recaptcha_tags %> + <%= f.submit %> +<% end %> diff -Nru ruby-recaptcha-0.4.0/demo/rails/app/views/users/index.html.erb ruby-recaptcha-3.2.0/demo/rails/app/views/users/index.html.erb --- ruby-recaptcha-0.4.0/demo/rails/app/views/users/index.html.erb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/app/views/users/index.html.erb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,5 @@ + + <% @users.each do |user| %> + + <% end %> +
<%= link_to user.name, edit_user_path(user) %>
diff -Nru ruby-recaptcha-0.4.0/demo/rails/bin/bundle ruby-recaptcha-3.2.0/demo/rails/bin/bundle --- ruby-recaptcha-0.4.0/demo/rails/bin/bundle 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/bin/bundle 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff -Nru ruby-recaptcha-0.4.0/demo/rails/bin/rails ruby-recaptcha-3.2.0/demo/rails/bin/rails --- ruby-recaptcha-0.4.0/demo/rails/bin/rails 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/bin/rails 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff -Nru ruby-recaptcha-0.4.0/demo/rails/bin/rake ruby-recaptcha-3.2.0/demo/rails/bin/rake --- ruby-recaptcha-0.4.0/demo/rails/bin/rake 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/bin/rake 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff -Nru ruby-recaptcha-0.4.0/demo/rails/bin/setup ruby-recaptcha-3.2.0/demo/rails/bin/setup --- ruby-recaptcha-0.4.0/demo/rails/bin/setup 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/bin/setup 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/bin/spring ruby-recaptcha-3.2.0/demo/rails/bin/spring --- ruby-recaptcha-0.4.0/demo/rails/bin/spring 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/bin/spring 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) + Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq } + gem 'spring', match[1] + require 'spring/binstub' + end +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/application.rb ruby-recaptcha-3.2.0/demo/rails/config/application.rb --- ruby-recaptcha-0.4.0/demo/rails/config/application.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/application.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Foo + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/boot.rb ruby-recaptcha-3.2.0/demo/rails/config/boot.rb --- ruby-recaptcha-0.4.0/demo/rails/config/boot.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/boot.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/database.yml ruby-recaptcha-3.2.0/demo/rails/config/database.yml --- ruby-recaptcha-0.4.0/demo/rails/config/database.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/database.yml 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/environment.rb ruby-recaptcha-3.2.0/demo/rails/config/environment.rb --- ruby-recaptcha-0.4.0/demo/rails/config/environment.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/environment.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/environments/development.rb ruby-recaptcha-3.2.0/demo/rails/config/environments/development.rb --- ruby-recaptcha-0.4.0/demo/rails/config/environments/development.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/environments/development.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/assets.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/assets.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/assets.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/assets.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/backtrace_silencers.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/backtrace_silencers.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/backtrace_silencers.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/backtrace_silencers.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/cookies_serializer.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/cookies_serializer.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/cookies_serializer.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/cookies_serializer.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/filter_parameter_logging.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/filter_parameter_logging.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/filter_parameter_logging.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/filter_parameter_logging.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/inflections.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/inflections.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/inflections.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/inflections.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/mime_types.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/mime_types.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/mime_types.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/mime_types.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/session_store.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/session_store.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/session_store.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/session_store.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_foo_session' diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/initializers/wrap_parameters.rb ruby-recaptcha-3.2.0/demo/rails/config/initializers/wrap_parameters.rb --- ruby-recaptcha-0.4.0/demo/rails/config/initializers/wrap_parameters.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/initializers/wrap_parameters.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/locales/en.yml ruby-recaptcha-3.2.0/demo/rails/config/locales/en.yml --- ruby-recaptcha-0.4.0/demo/rails/config/locales/en.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/locales/en.yml 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/routes.rb ruby-recaptcha-3.2.0/demo/rails/config/routes.rb --- ruby-recaptcha-0.4.0/demo/rails/config/routes.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/routes.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,5 @@ +Rails.application.routes.draw do + root to: "captcha#index" + post "/captchas" => "captcha#create" + resources :users +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/config/secrets.yml ruby-recaptcha-3.2.0/demo/rails/config/secrets.yml --- ruby-recaptcha-0.4.0/demo/rails/config/secrets.yml 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config/secrets.yml 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: c9f78eaa370cf6e763541491003469a07754b0ed2d37638e13c892540ecae39311ed928af595b3b7603807950c46ca49249e5c8c9db7c1faccbe71a6bb76cee9 + +test: + secret_key_base: a9bd3f4f67f18b8a9333886d8552528265d5962385de1b1f2b3883214c06d6a53dced9fc954b9649de9c8e4da0925d41427aad6d4aa76e5570eade23ab27c85c + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff -Nru ruby-recaptcha-0.4.0/demo/rails/config.ru ruby-recaptcha-3.2.0/demo/rails/config.ru --- ruby-recaptcha-0.4.0/demo/rails/config.ru 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/config.ru 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff -Nru ruby-recaptcha-0.4.0/demo/rails/db/migrate/20151226015155_add_user.rb ruby-recaptcha-3.2.0/demo/rails/db/migrate/20151226015155_add_user.rb --- ruby-recaptcha-0.4.0/demo/rails/db/migrate/20151226015155_add_user.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/db/migrate/20151226015155_add_user.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,7 @@ +class AddUser < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + end + end +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/db/schema.rb ruby-recaptcha-3.2.0/demo/rails/db/schema.rb --- ruby-recaptcha-0.4.0/demo/rails/db/schema.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/db/schema.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,20 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20151226015155) do + + create_table "users", force: :cascade do |t| + t.string "name" + end + +end diff -Nru ruby-recaptcha-0.4.0/demo/rails/db/seeds.rb ruby-recaptcha-3.2.0/demo/rails/db/seeds.rb --- ruby-recaptcha-0.4.0/demo/rails/db/seeds.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/db/seeds.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1 @@ +User.create! name: "Tester" diff -Nru ruby-recaptcha-0.4.0/demo/rails/.env ruby-recaptcha-3.2.0/demo/rails/.env --- ruby-recaptcha-0.4.0/demo/rails/.env 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/.env 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,3 @@ +# these will only work on localhost ... make your own at https://www.google.com/recaptcha +RECAPTCHA_PUBLIC_KEY=6Le7oRETAAAAAETt105rjswZ15EuVJiF7BxPROkY +RECAPTCHA_PRIVATE_KEY=6Le7oRETAAAAAL5a8yOmEdmDi3b2pH7mq5iH1bYK diff -Nru ruby-recaptcha-0.4.0/demo/rails/Gemfile ruby-recaptcha-3.2.0/demo/rails/Gemfile --- ruby-recaptcha-0.4.0/demo/rails/Gemfile 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/Gemfile 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'dotenv-rails', groups: [:development, :test] +gem 'rails', '4.2.5' +gem 'sqlite3' +gem 'recaptcha', require: 'recaptcha/rails', path: '../..' diff -Nru ruby-recaptcha-0.4.0/demo/rails/Gemfile.lock ruby-recaptcha-3.2.0/demo/rails/Gemfile.lock --- ruby-recaptcha-0.4.0/demo/rails/Gemfile.lock 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/Gemfile.lock 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,115 @@ +PATH + remote: ../.. + specs: + recaptcha (1.1.0) + json + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.5) + actionpack (= 4.2.5) + actionview (= 4.2.5) + activejob (= 4.2.5) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.5) + actionview (= 4.2.5) + activesupport (= 4.2.5) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.5) + activesupport (= 4.2.5) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.5) + activesupport (= 4.2.5) + globalid (>= 0.3.0) + activemodel (4.2.5) + activesupport (= 4.2.5) + builder (~> 3.1) + activerecord (4.2.5) + activemodel (= 4.2.5) + activesupport (= 4.2.5) + arel (~> 6.0) + activesupport (4.2.5) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.3) + builder (3.2.2) + dotenv (2.0.2) + dotenv-rails (2.0.2) + dotenv (= 2.0.2) + railties (~> 4.0) + erubis (2.7.0) + globalid (0.3.6) + activesupport (>= 4.1.0) + i18n (0.7.0) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.99) + mini_portile (0.6.2) + minitest (5.8.3) + nokogiri (1.6.6.4) + mini_portile (~> 0.6.0) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.5) + actionmailer (= 4.2.5) + actionpack (= 4.2.5) + actionview (= 4.2.5) + activejob (= 4.2.5) + activemodel (= 4.2.5) + activerecord (= 4.2.5) + activesupport (= 4.2.5) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.5) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.5) + actionpack (= 4.2.5) + activesupport (= 4.2.5) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + sprockets (3.4.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.11) + thor (0.19.1) + thread_safe (0.3.5) + tzinfo (1.2.2) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + dotenv-rails + rails (= 4.2.5) + recaptcha! + sqlite3 + +BUNDLED WITH + 1.11.2 diff -Nru ruby-recaptcha-0.4.0/demo/rails/.gitignore ruby-recaptcha-3.2.0/demo/rails/.gitignore --- ruby-recaptcha-0.4.0/demo/rails/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/.gitignore 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp Binary files /tmp/tmpHp5eIo/5_QUsaI_ZW/ruby-recaptcha-0.4.0/demo/rails/public/favicon.ico and /tmp/tmpHp5eIo/UmzJkKWiPQ/ruby-recaptcha-3.2.0/demo/rails/public/favicon.ico differ diff -Nru ruby-recaptcha-0.4.0/demo/rails/Rakefile ruby-recaptcha-3.2.0/demo/rails/Rakefile --- ruby-recaptcha-0.4.0/demo/rails/Rakefile 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/rails/Rakefile 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff -Nru ruby-recaptcha-0.4.0/demo/sinatra/Gemfile ruby-recaptcha-3.2.0/demo/sinatra/Gemfile --- ruby-recaptcha-0.4.0/demo/sinatra/Gemfile 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/sinatra/Gemfile 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'recaptcha', require: 'recaptcha/rails', path: '../..' diff -Nru ruby-recaptcha-0.4.0/demo/sinatra/Gemfile.lock ruby-recaptcha-3.2.0/demo/sinatra/Gemfile.lock --- ruby-recaptcha-0.4.0/demo/sinatra/Gemfile.lock 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/sinatra/Gemfile.lock 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,28 @@ +PATH + remote: ../.. + specs: + recaptcha (0.6.0) + json + +GEM + remote: https://rubygems.org/ + specs: + json (1.8.1) + rack (1.6.4) + rack-protection (1.5.3) + rack + sinatra (1.4.6) + rack (~> 1.4) + rack-protection (~> 1.4) + tilt (>= 1.3, < 3) + tilt (2.0.1) + +PLATFORMS + ruby + +DEPENDENCIES + recaptcha! + sinatra + +BUNDLED WITH + 1.10.6 diff -Nru ruby-recaptcha-0.4.0/demo/sinatra/server.rb ruby-recaptcha-3.2.0/demo/sinatra/server.rb --- ruby-recaptcha-0.4.0/demo/sinatra/server.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/demo/sinatra/server.rb 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,29 @@ +require 'bundler/setup' +require 'sinatra' +require 'recaptcha' + +# these will only work on localhost ... make your own at https://www.google.com/recaptcha +Recaptcha.configure do |config| + config.public_key = '6Le7oRETAAAAAETt105rjswZ15EuVJiF7BxPROkY' + config.private_key = '6Le7oRETAAAAAL5a8yOmEdmDi3b2pH7mq5iH1bYK' +end + +include Recaptcha::ClientHelper +include Recaptcha::Verify + +get '/' do + <<-HTML +
+ #{recaptcha_tags} + +
+ HTML +end + +get '/verify' do + if verify_recaptcha + 'YES!' + else + 'NO!' + end +end diff -Nru ruby-recaptcha-0.4.0/Gemfile.lock ruby-recaptcha-3.2.0/Gemfile.lock --- ruby-recaptcha-0.4.0/Gemfile.lock 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/Gemfile.lock 2016-06-13 17:14:08.000000000 +0000 @@ -1,52 +1,79 @@ PATH remote: . specs: - recaptcha (0.4.0) + recaptcha (3.2.0) + json GEM remote: https://rubygems.org/ specs: - activesupport (4.1.8) - i18n (~> 0.6, >= 0.6.9) + activesupport (4.2.5) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - byebug (3.5.1) - columnize (~> 0.8) - debugger-linecache (~> 1.2) - slop (~> 3.6) + addressable (2.3.8) + ast (2.3.0) + bump (0.5.3) + byebug (8.2.0) coderay (1.1.0) - columnize (0.8.9) - debugger-linecache (1.2.0) - i18n (0.6.11) - json (1.8.1) + crack (0.4.2) + safe_yaml (~> 1.0.0) + hashdiff (0.2.3) + i18n (0.7.0) + json (1.8.3) + maxitest (1.5.4) + minitest (>= 5.0.0, < 5.9.0) metaclass (0.0.4) method_source (0.8.2) - minitest (5.4.3) + minitest (5.8.3) mocha (1.1.0) metaclass (~> 0.0.1) - pry (0.10.1) + parser (2.3.1.2) + ast (~> 2.2) + powerpack (0.1.1) + pry (0.10.3) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry-byebug (2.0.0) - byebug (~> 3.4) + pry-byebug (3.3.0) + byebug (~> 8.0) pry (~> 0.10) - rake (10.3.2) + rainbow (2.1.0) + rake (10.4.2) + rubocop (0.40.0) + parser (>= 2.3.1.0, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + safe_yaml (1.0.4) slop (3.6.0) - thread_safe (0.3.4) + thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) + unicode-display_width (1.0.5) + webmock (1.22.3) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff PLATFORMS ruby DEPENDENCIES activesupport + bump i18n - minitest (~> 5.0) + maxitest mocha pry-byebug rake recaptcha! + rubocop + webmock + +BUNDLED WITH + 1.12.3 diff -Nru ruby-recaptcha-0.4.0/init.rb ruby-recaptcha-3.2.0/init.rb --- ruby-recaptcha-0.4.0/init.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/init.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -# Rails plugin initialization. -# You can also install it as a gem: -# config.gem "ambethia-recaptcha", :lib => "recaptcha/rails", :source => "http://gems.github.com" - -require 'recaptcha/rails' \ No newline at end of file diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/client_helper.rb ruby-recaptcha-3.2.0/lib/recaptcha/client_helper.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/client_helper.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/client_helper.rb 2016-06-13 17:14:08.000000000 +0000 @@ -3,119 +3,56 @@ # Your public API can be specified in the +options+ hash or preferably # using the Configuration. def recaptcha_tags(options = {}) - return v1_tags(options) if Recaptcha.configuration.v1? - return v2_tags(options) if Recaptcha.configuration.v2? - end # recaptcha_tags - - def v1_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]) - lang = options[:display] && options[:display][:lang] ? options[:display][:lang].to_sym : "" - html = "" - if options[:display] - html << %{\n} + if options.key?(:stoken) + raise(RecaptchaError, "Secure Token is deprecated. Please remove 'stoken' from your calls to recaptcha_tags.") end - if options[:ajax] - if options[:display] && options[:display][:custom_theme_widget] - widget = options[:display][:custom_theme_widget] - else - widget = "dynamic_recaptcha" - html << <<-EOS -
- EOS - end - html << <<-EOS - - EOS - else - html << %{\n} - unless options[:noscript] == false - html << %{\n} - end + if options.key?(:ssl) + raise(RecaptchaError, "SSL is now always true. Please remove 'ssl' from your calls to recaptcha_tags.") end - return (html.respond_to?(:html_safe) && html.html_safe) || html - end - def v2_tags(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]) - uri += "?hl=#{options[:hl]}" unless options[:hl].blank? - - v2_options = options.slice(:theme, :type, :callback).map {|k,v| %{data-#{k}="#{v}"} }.join(" ") - - html = "" - html << %{\n} - html << %{
\n} - - unless options[:noscript] == false - fallback_uri = "#{uri.chomp('.js')}/fallback?k=#{key}" - html << %{} + public_key = options[:public_key] || Recaptcha.configuration.public_key! + + script_url = Recaptcha.configuration.api_server_url + script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == "" + fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{public_key}" + + data_attributes = [:theme, :type, :callback, :expired_callback, :size] + data_attributes = options.each_with_object({}) do |(k, v), a| + a[k] = v if data_attributes.include?(k) end + data_attributes[:sitekey] = public_key + data_attributes = data_attributes.map { |k, v| %(data-#{k.to_s.tr('_', '-')}="#{v}") }.join(" ") - return (html.respond_to?(:html_safe) && html.html_safe) || html - end + html = %(\n) + html << %(
\n) - private + if options[:noscript] != false + html << <<-HTML + + HTML + end - def hash_to_json(hash) - result = "{" - result << hash.map do |k, v| - if v.is_a?(Hash) - "\"#{k}\": #{hash_to_json(v)}" - elsif ! v.is_a?(String) || k.to_s == "callback" - "\"#{k}\": #{v}" - else - "\"#{k}\": \"#{v}\"" - end - end.join(", ") - result << "}" + html.respond_to?(:html_safe) ? html.html_safe : html end - end # ClientHelper -end # Recaptcha + end +end diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/configuration.rb ruby-recaptcha-3.2.0/lib/recaptcha/configuration.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/configuration.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/configuration.rb 2016-06-13 17:14:08.000000000 +0000 @@ -28,47 +28,30 @@ # end # class Configuration - attr_accessor :api_version, - :skip_verify_env, - :private_key, - :public_key, - :proxy, - :handle_timeouts_gracefully, - :use_ssl_by_default + attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :hostname def initialize #:nodoc: - @api_version = RECAPTCHA_API_VERSION - @skip_verify_env = SKIP_VERIFY_ENV + @skip_verify_env = %w[test cucumber] @handle_timeouts_gracefully = HANDLE_TIMEOUTS_GRACEFULLY - @use_ssl_by_default = USE_SSL_BY_DEFAULT @private_key = ENV['RECAPTCHA_PRIVATE_KEY'] - @public_key = ENV['RECAPTCHA_PUBLIC_KEY'] + @public_key = ENV['RECAPTCHA_PUBLIC_KEY'] end - def api_server_url(ssl = nil) #:nodoc: - ssl = use_ssl_by_default if ssl.nil? - ssl ? ssl_api_server_url : nonssl_api_server_url + def private_key! + private_key || raise(RecaptchaError, "No private key specified.") end - def nonssl_api_server_url - CONFIG[@api_version]['server_url'] + def public_key! + public_key || raise(RecaptchaError, "No public key specified.") end - def ssl_api_server_url - CONFIG[@api_version]['secure_server_url'] + def api_server_url + CONFIG.fetch('server_url') end def verify_url - CONFIG[@api_version]['verify_url'] - end - - def v1? - @api_version == 'v1' - end - - def v2? - @api_version == 'v2' + CONFIG.fetch('verify_url') end end end diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/merb.rb ruby-recaptcha-3.2.0/lib/recaptcha/merb.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/merb.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/merb.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -require 'recaptcha' - -Merb::GlobalHelpers.send(:include, Recaptcha::ClientHelper) -Merb::Controller.send(:include, Recaptcha::Verify) diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/rails.rb ruby-recaptcha-3.2.0/lib/recaptcha/rails.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/rails.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/rails.rb 2016-06-13 17:14:08.000000000 +0000 @@ -1,5 +1,10 @@ -require 'net/http' require 'recaptcha' -ActionView::Base.send(:include, Recaptcha::ClientHelper) -ActionController::Base.send(:include, Recaptcha::Verify) \ No newline at end of file +module Recaptcha + class Railtie < Rails::Railtie + initializer :recaptcha do + ActionView::Base.send(:include, ::Recaptcha::ClientHelper) + ActionController::Base.send(:include, ::Recaptcha::Verify) + end + end +end diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/railtie.rb ruby-recaptcha-3.2.0/lib/recaptcha/railtie.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/railtie.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/railtie.rb 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -require 'net/http' -require 'recaptcha' -module Rails - module Recaptcha - class Railtie < Rails::Railtie - initializer "setup config" do - begin - ActionView::Base.send(:include, ::Recaptcha::ClientHelper) - ActionController::Base.send(:include, ::Recaptcha::Verify) - end - end - end - end -end - diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/verify.rb ruby-recaptcha-3.2.0/lib/recaptcha/verify.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/verify.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/verify.rb 2016-06-13 17:14:08.000000000 +0000 @@ -1,111 +1,102 @@ -require "uri" +require 'json' + module Recaptcha module Verify # Your private API can be specified in the +options+ hash or preferably # using the Configuration. def verify_recaptcha(options = {}) - options = {:model => options} unless options.is_a? Hash + options = {model: options} unless options.is_a? Hash + return true if Recaptcha::Verify.skip?(options[:env]) - env_options = options[:env] || ENV['RAILS_ENV'] - return true if Recaptcha.configuration.skip_verify_env.include? env_options 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 + recaptcha_response = options[:response] || params['g-recaptcha-response'].to_s begin - recaptcha = nil - if(Recaptcha.configuration.proxy) - proxy_server = URI.parse(Recaptcha.configuration.proxy) - http = Net::HTTP::Proxy(proxy_server.host, proxy_server.port, proxy_server.user, proxy_server.password) + verified = if recaptcha_response.empty? + false else - http = Net::HTTP - end - - # env['REMOTE_ADDR'] to retrieve IP for Grape API - remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR']) - if Recaptcha.configuration.v1? - verify_hash = { - "privatekey" => private_key, - "remoteip" => remote_ip, - "challenge" => params[:recaptcha_challenge_field], - "response" => params[:recaptcha_response_field] - } - Timeout::timeout(options[:timeout] || 3) do - recaptcha = http.post_form(URI.parse(Recaptcha.configuration.verify_url), verify_hash) - end - answer, error = recaptcha.body.split.map { |s| s.chomp } + recaptcha_verify_via_api_call(request, recaptcha_response, options) end - if Recaptcha.configuration.v2? - verify_hash = { - "secret" => private_key, - "remoteip" => remote_ip, - "response" => params['g-recaptcha-response'] - } - - Timeout::timeout(options[:timeout] || 3) do - uri = URI.parse(Recaptcha.configuration.verify_url + '?' + verify_hash.to_query) - http_instance = http.new(uri.host, uri.port) - if uri.port==443 - http_instance.use_ssl = - http_instance.verify_mode = OpenSSL::SSL::VERIFY_NONE - end - request = Net::HTTP::Get.new(uri.request_uri) - recaptcha = http_instance.request(request) - end - answer, error = JSON.parse(recaptcha.body).values - end - - unless answer.to_s == 'true' - error = 'verification_failed' if error && Recaptcha.configuration.v2? - if request_in_html_format? - flash[:recaptcha_error] = if defined?(I18n) - I18n.translate("recaptcha.errors.#{error}", {:default => error}) - else - error - end - end - - if model - message = "Word verification response is incorrect, please try again." - message = I18n.translate('recaptcha.errors.verification_failed', {:default => message}) if defined?(I18n) - model.errors.add attribute, options[:message] || message - end - return false + if verified + flash.delete(:recaptcha_error) if recaptcha_flash_supported? && !model + true else - flash.delete(:recaptcha_error) if request_in_html_format? - return true + recaptcha_error( + model, + attribute, + options[:message], + "recaptcha.errors.verification_failed", + "reCAPTCHA verification failed, please try again." + ) + false end rescue Timeout::Error if Recaptcha.configuration.handle_timeouts_gracefully - if request_in_html_format? - flash[:recaptcha_error] = if defined?(I18n) - I18n.translate('recaptcha.errors.recaptcha_unreachable', {:default => 'Recaptcha unreachable.'}) - else - 'Recaptcha unreachable.' - end - end - - if model - message = "Oops, we failed to validate your word verification response. Please try again." - message = I18n.translate('recaptcha.errors.recaptcha_unreachable', :default => message) if defined?(I18n) - model.errors.add attribute, options[:message] || message - end - return false + recaptcha_error( + model, + attribute, + options[:message], + "recaptcha.errors.recaptcha_unreachable", + "Oops, we failed to validate your reCAPTCHA response. Please try again." + ) + false else raise RecaptchaError, "Recaptcha unreachable." end - rescue Exception => e + rescue StandardError => e raise RecaptchaError, e.message, e.backtrace end - end # verify_recaptcha + end + + def verify_recaptcha!(options = {}) + verify_recaptcha(options) || raise(VerifyError) + end + + def self.skip?(env) + env ||= ENV['RACK_ENV'] || ENV['RAILS_ENV'] || (Rails.env if defined? Rails.env) + Recaptcha.configuration.skip_verify_env.include? env + end + + private + + def recaptcha_verify_via_api_call(request, recaptcha_response, options) + private_key = options[:private_key] || Recaptcha.configuration.private_key! + remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR']) + + verify_hash = { + "secret" => private_key, + "remoteip" => remote_ip.to_s, + "response" => recaptcha_response + } + + reply = JSON.parse(Recaptcha.get(verify_hash, options)) + reply['success'].to_s == "true" && + recaptcha_hostname_valid?(reply['hostname'], options[:hostname]) + end + + def recaptcha_hostname_valid?(hostname, validation) + validation ||= Recaptcha.configuration.hostname + + case validation + when nil, FalseClass then true + when String then validation == hostname + else validation.call(hostname) + end + end - def request_in_html_format? + def recaptcha_error(model, attribute, message, key, default) + message ||= Recaptcha.i18n(key, default) + if model + model.errors.add attribute, message + else + flash[:recaptcha_error] = message if recaptcha_flash_supported? + end + end + + def recaptcha_flash_supported? request.respond_to?(:format) && request.format == :html && respond_to?(:flash) end - def verify_recaptcha!(options = {}) - verify_recaptcha(options) or raise VerifyError - end #verify_recaptcha! - end # Verify -end # Recaptcha + end +end diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha/version.rb ruby-recaptcha-3.2.0/lib/recaptcha/version.rb --- ruby-recaptcha-0.4.0/lib/recaptcha/version.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha/version.rb 2016-06-13 17:14:08.000000000 +0000 @@ -1,3 +1,3 @@ module Recaptcha - VERSION = "0.4.0" + VERSION = "3.2.0".freeze end diff -Nru ruby-recaptcha-0.4.0/lib/recaptcha.rb ruby-recaptcha-3.2.0/lib/recaptcha.rb --- ruby-recaptcha-0.4.0/lib/recaptcha.rb 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/lib/recaptcha.rb 2016-06-13 17:14:08.000000000 +0000 @@ -1,27 +1,18 @@ require 'recaptcha/configuration' require 'recaptcha/client_helper' require 'recaptcha/verify' +require 'uri' +require 'net/http' module Recaptcha - CONFIG = - { - 'v1' => { - 'server_url' => '//www.google.com/recaptcha/api', - 'secure_server_url' => 'https://www.google.com/recaptcha/api', - 'verify_url' => 'http://www.google.com/recaptcha/api/verify' - }, - - 'v2' => { - 'server_url' => '//www.google.com/recaptcha/api.js', - 'secure_server_url' => 'https://www.google.com/recaptcha/api.js', - 'verify_url' => 'https://www.google.com/recaptcha/api/siteverify' - } - } + CONFIG = { + 'server_url' => 'https://www.google.com/recaptcha/api.js', + 'verify_url' => 'https://www.google.com/recaptcha/api/siteverify' + }.freeze - RECAPTCHA_API_VERSION = 'v2' USE_SSL_BY_DEFAULT = false HANDLE_TIMEOUTS_GRACEFULLY = true - SKIP_VERIFY_ENV = ['test', 'cucumber'] + DEFAULT_TIMEOUT = 3 # Gives access to the current Configuration. def self.configuration @@ -47,20 +38,38 @@ configuration.send("#{key}=", value) end - result = yield if block_given? - + yield if block_given? + ensure original_config.each { |key, value| configuration.send("#{key}=", value) } - result end - class RecaptchaError < StandardError + def self.get(verify_hash, options) + http = if Recaptcha.configuration.proxy + proxy_server = URI.parse(Recaptcha.configuration.proxy) + Net::HTTP::Proxy(proxy_server.host, proxy_server.port, proxy_server.user, proxy_server.password) + else + Net::HTTP + end + query = URI.encode_www_form(verify_hash) + uri = URI.parse(Recaptcha.configuration.verify_url + '?' + query) + http_instance = http.new(uri.host, uri.port) + http_instance.read_timeout = http_instance.open_timeout = options[:timeout] || DEFAULT_TIMEOUT + http_instance.use_ssl = true if uri.port == 443 + request = Net::HTTP::Get.new(uri.request_uri) + http_instance.request(request).body end - class VerifyError < RecaptchaError + def self.i18n(key, default) + if defined?(I18n) + I18n.translate(key, default: default) + else + default + end end -end + class RecaptchaError < StandardError + end -if defined?(Rails) - require 'recaptcha/rails' + class VerifyError < RecaptchaError + end end diff -Nru ruby-recaptcha-0.4.0/Rakefile ruby-recaptcha-3.2.0/Rakefile --- ruby-recaptcha-0.4.0/Rakefile 2015-03-22 16:40:12.000000000 +0000 +++ ruby-recaptcha-3.2.0/Rakefile 2016-06-13 17:14:08.000000000 +0000 @@ -1,8 +1,15 @@ +require "bundler/setup" require "bundler/gem_tasks" require "rake/testtask" +require "bump/tasks" Rake::TestTask.new do |t| t.test_files = FileList['test/*_test.rb'] end -task :default => :test +desc "rubocop" +task :rubocop do + sh "rubocop --display-cop-names" +end + +task default: [:test, :rubocop] diff -Nru ruby-recaptcha-0.4.0/README.md ruby-recaptcha-3.2.0/README.md --- ruby-recaptcha-0.4.0/README.md 1970-01-01 00:00:00.000000000 +0000 +++ ruby-recaptcha-3.2.0/README.md 2016-06-13 17:14:08.000000000 +0000 @@ -0,0 +1,163 @@ +# 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). + +```Ruby +gem "recaptcha", require: "recaptcha/rails" +``` + +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_PUBLIC_KEY = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy' +export RECAPTCHA_PRIVATE_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