recaptcha 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 275c68afb011d4d29e5ca658017371b578826960
4
- data.tar.gz: 0fea70c747d90519985fc733a9423e35fad8bdea
3
+ metadata.gz: 529e90efb6c6981d74f7f1129efbb672e441ca35
4
+ data.tar.gz: 81e122d8e18de0b1cc4f63ba1651587c18f5bdb6
5
5
  SHA512:
6
- metadata.gz: 199a230be03b890f2c937f5edd53760e510c087faed04cb86de8a191fe3bccabfd95434193ec5cf23c350d90c3d62f949d59de2388661fd746ceada639b8aaf8
7
- data.tar.gz: c6059bc4929ba3f85cd667efd2a29b08bf2602b409118d8fba8a6635d9988a9f934254f968fed641c29b422911f81ce813663e9e6d4ee4cf5b02f4695898a4f0
6
+ metadata.gz: b23f3ce97fb48211958f541a105050ba160a17f6c363634bb8c4aeddf8a161e57c592c96b2fa665e89379b8c84cd9d63415ca5cba7e3ab67aa0757ccdb5d68a0
7
+ data.tar.gz: 6b7828dd0be7e1317dd82f4130c1cde4a7f51c90890946a2d5ff623da3c863738eb2cad27c29d79e0821393a61792f6b64b9f0d94f892b40e8bc1855d15395ce
data/README.md CHANGED
@@ -99,6 +99,30 @@ Some of the options available:
99
99
  | :hostname | Expected hostname or a callable that validates the hostname, see [domain validation](https://developers.google.com/recaptcha/docs/domain_validation) and [hostname](https://developers.google.com/recaptcha/docs/verify#api-response) docs. (default: `nil`, but can be changed by setting `config.hostname`)
100
100
  | :env | Current environment. The request to verify will be skipped if the environment is specified in configuration under `skip_verify_env`
101
101
 
102
+ ## invisible_recaptcha_tags
103
+
104
+ [Invisible reCAPTCHA](https://developers.google.com/recaptcha/docs/invisible) has two differences:
105
+
106
+ 1. Needs a callback function, which is called after verification with Google's reCAPTCHA service. This callback function must submit the form.
107
+ 2. The `invisible_recaptcha_tags` generates a submit button.
108
+
109
+ ```Erb
110
+ <%= form_for @foo, html: {id: 'invisible-recaptcha-form'} do |f| %>
111
+ # ... other tags
112
+ <%= invisible_recaptcha_tags callback: 'submitInvisibleRecaptchaForm' %>
113
+ <% end %>
114
+ ```
115
+
116
+ ```Javascript
117
+ // app/assets/javascripts/application.js
118
+ var submitInvisibleRecaptchaForm = function () {
119
+ document.getElementById("invisible-recaptcha-form").submit();
120
+ };
121
+ ```
122
+
123
+ Finally, add `verify_recaptcha` to your controller as seen [above](#rails-installation).
124
+
125
+
102
126
  ## I18n support
103
127
  reCAPTCHA passes two types of error explanation to a linked model. It will use the I18n gem
104
128
  to translate the default error message if I18n is available. To customize the messages to your locale,
@@ -28,7 +28,8 @@ module Recaptcha
28
28
  # end
29
29
  #
30
30
  class Configuration
31
- attr_accessor :skip_verify_env, :secret_key, :site_key, :proxy, :handle_timeouts_gracefully, :hostname
31
+ attr_accessor :skip_verify_env, :secret_key, :site_key, :api_server_url, :verify_url, :proxy,
32
+ :handle_timeouts_gracefully, :hostname
32
33
 
33
34
  def initialize #:nodoc:
34
35
  @skip_verify_env = %w[test cucumber]
@@ -47,11 +48,11 @@ module Recaptcha
47
48
  end
48
49
 
49
50
  def api_server_url
50
- CONFIG.fetch('server_url')
51
+ @api_server_url || CONFIG.fetch('server_url')
51
52
  end
52
53
 
53
54
  def verify_url
54
- CONFIG.fetch('verify_url')
55
+ @verify_url || CONFIG.fetch('verify_url')
55
56
  end
56
57
  end
57
58
  end
@@ -1,3 +1,3 @@
1
1
  module Recaptcha
2
- VERSION = "4.1.0".freeze
2
+ VERSION = "4.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason L Perry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json