recaptcha 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba681f9321310ca16bb41dc622bf7051c30df10ec000582f9dd8d29310e21136
4
- data.tar.gz: 8d9a3a4a7adb2ea830f17ace469e6b475d4d5c633c6988cd04dd56a7fd70e414
3
+ metadata.gz: 849f0b2edee6bde557c0bdab3802dfbc7528a5e777709a110b6c4f228842c1a1
4
+ data.tar.gz: ebf65ad28a50a06363bc7544df1ef2639aefebbeace7f15cd97fd1ffc047764c
5
5
  SHA512:
6
- metadata.gz: efba5551493debe23617c41db429c224f51a4d0253274cf6fe28c5e384d78f4bd374ba3ad3132c2009cb2df9813266ac3a90eabd9a019aa7d48ee3999f2451e3
7
- data.tar.gz: 1dfd4f2281c8f6902b1c70ca0d272d0d2f671d9062669f147cfb38416ee771e7348ff131c8fd957c1e8674b7d83ad3f3c79f6c306a7779638b4481000534f695
6
+ metadata.gz: 68f606e91517a8062d7afe48e43d306383f4ef4c83ac4c61179f9ea58d38628230768865604a61758bfd3d5b0d1a2197a981b764169153e36ef0bcf7bedb86d9
7
+ data.tar.gz: c87318df857db04fb2485c73ba686d82f3d18ed87cc0db8f006bbe2f456179218aeb25b1477017b80240504329cc9d02acd9b09457ae927997a5b61dd6849228
@@ -1,5 +1,14 @@
1
1
  ## Next
2
2
 
3
+ ## 5.5.0
4
+ * add `recaptcha_reply` controller method for better debugging/inspection
5
+
6
+ ## 5.4.1
7
+ * fix v2 vs 'data' postfix
8
+
9
+ ## 5.4.0
10
+ * added 'data' postfix to g-recaptcha-response attribute name to avoid collisions
11
+
3
12
  ## 5.3.0
4
13
  * turbolinks support
5
14
 
data/README.md CHANGED
@@ -119,7 +119,7 @@ The following options are available:
119
119
  Any unrecognized options will be added as attributes on the generated tag.
120
120
 
121
121
  You can also override the html attributes for the sizes of the generated `textarea` and `iframe`
122
- elements, if CSS isn't your thing. Inspect the [source of `recaptcha_tags`](https://github.com/ambethia/recaptcha/blob/master/lib/recaptcha/client_helper.rb)
122
+ elements, if CSS isn't your thing. Inspect the [source of `recaptcha_tags`](https://github.com/ambethia/recaptcha/blob/master/lib/recaptcha/helpers.rb)
123
123
  to see these options.
124
124
 
125
125
  Note that you cannot submit/verify the same response token more than once or you will get a
@@ -278,7 +278,7 @@ threshold:
278
278
  <% if @show_checkbox_recaptcha %>
279
279
  <%= recaptcha_tags %>
280
280
  <% else %>
281
- <%= recaptcha_v3(action: 'login') %>
281
+ <%= recaptcha_v3(action: 'login', site_key: ENV['RECAPTCHA_SITE_KEY_V3']) %>
282
282
  <% end %>
283
283
 
284
284
  ```
@@ -286,7 +286,7 @@ threshold:
286
286
  ```ruby
287
287
  # app/controllers/sessions_controller.rb
288
288
  def create
289
- success = verify_recaptcha(action: 'login', minimum_score: 0.5)
289
+ success = verify_recaptcha(action: 'login', minimum_score: 0.5, secret_key: ENV['RECAPTCHA_SECRET_KEY_V3'])
290
290
  checkbox_success = verify_recaptcha unless success
291
291
  if success || checkbox_success
292
292
  # Perform action
@@ -271,6 +271,7 @@ module Recaptcha
271
271
  private_class_method def self.default_callback(options = {})
272
272
  nonce = options[:nonce]
273
273
  nonce_attr = " nonce='#{nonce}'" if nonce
274
+ selector_attr = options[:id] ? "##{options[:id]}" : ".g-recaptcha"
274
275
 
275
276
  <<-HTML
276
277
  <script#{nonce_attr}>
@@ -283,9 +284,9 @@ module Recaptcha
283
284
  return curEle.nodeName === 'FORM' ? curEle : null
284
285
  };
285
286
 
286
- var eles = document.getElementsByClassName('g-recaptcha');
287
- if (eles.length > 0) {
288
- var form = closestForm(eles[0]);
287
+ var el = document.querySelector("#{selector_attr}")
288
+ if (!!el) {
289
+ var form = closestForm(el);
289
290
  if (form) {
290
291
  form.submit();
291
292
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Recaptcha
4
- VERSION = '5.5.0'
4
+ VERSION = '5.6.0'
5
5
  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: 5.5.0
4
+ version: 5.6.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: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3
178
+ rubygems_version: 3.1.3
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Helpers for the reCAPTCHA API