recaptcha 5.3.0 → 5.4.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: adcc7a846c1b2cbac386af0946cd3c810803860f85ca363e5453582354c618b0
4
- data.tar.gz: b1ac10dd569bc7220b81505c9c6565d3db900a3c737ed1c184dcd1c96a12c963
3
+ metadata.gz: d2f048639c2186d2b96ee2ee90a94b928443be2d068e9a4cb5fc3c840f0b2673
4
+ data.tar.gz: 35215a7a9ebdceba2512c01c5d52a19cdf0afb1763045222a81e1a7203771793
5
5
  SHA512:
6
- metadata.gz: 8f9f6271ee715f1fbe543ed1b27cc8088678f5da8326718ad60587128e550fbb9073558fa147a4b608469da82af4cfd86ee255c39a7f69e0bd6b1d590ac109d8
7
- data.tar.gz: 94fbd105e5b6f1cf23fd23cb5dac6040d9e642d5110beae4b9982c6a232f24323ed9ab145b3aa9ef7f6d5786537a20ea03dfacde5638c5f82d5921999c398bd7
6
+ metadata.gz: fc3b564d5f7825ee75f1c5cad3df00f7712b7076a2616f4f8b4bd7ca14ee33d0fa7063555a0544773bf4796922a3a9672ab14b1fc53e29920ff5bfeb956f9f57
7
+ data.tar.gz: e2c2a17557f57ac6343cce586e002647c8e70136786fd3660f60ed4dba6f689761935c883ea37b9adbae1829d4187c28fe7e3467bebc35670e27ee371aecad0b
data/README.md CHANGED
@@ -147,7 +147,7 @@ Some of the options available:
147
147
  | `:message` | Custom error message.
148
148
  | `:secret_key` | Override the secret API key from the configuration.
149
149
  | `:timeout` | The number of seconds to wait for reCAPTCHA servers before give up. (default: `3`)
150
- | `:response` | Custom response parameter. (default: `params['g-recaptcha-response']`)
150
+ | `:response` | Custom response parameter. (default: `params['g-recaptcha-response-data']`)
151
151
  | `: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`)
152
152
  | `:env` | Current environment. The request to verify will be skipped if the environment is specified in configuration under `skip_verify_env`
153
153
 
@@ -344,7 +344,7 @@ function). This lets you include `recaptcha_v3` within a `<form>` tag and have i
344
344
  submit the token as part of the form submission.
345
345
 
346
346
  Note: reCAPTCHA actually already adds its own hidden tag, like `<textarea
347
- id="g-recaptcha-response-100000" name="g-recaptcha-response" class="g-recaptcha-response">`,
347
+ id="g-recaptcha-response-data-100000" name="g-recaptcha-response-data" class="g-recaptcha-response">`,
348
348
  immediately ater the reCAPTCHA badge in the bottom right of the page — but since it is not inside of
349
349
  any `<form>` element, and since it already passes the token to the callback, this hidden `textarea`
350
350
  isn't helpful to us.
@@ -353,7 +353,7 @@ If you need to submit the response token to the server in a different way than v
353
353
  submit, such as via [Ajax](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) or [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API),
354
354
  then you can either:
355
355
  1. just extract the token out of the hidden `<input>` or `<textarea>` (both of which will have a
356
- predictable name/id), like `document.getElementById('g-recaptcha-response-my-action').value`, or
356
+ predictable name/id), like `document.getElementById('g-recaptcha-response-data-my-action').value`, or
357
357
  2. write and specify a custom `callback` function. You may also want to pass `element: false` if you
358
358
  don't have a use for the hidden input element.
359
359
 
@@ -388,8 +388,8 @@ but only accepts the following options:
388
388
  | `:action` | The name of the [reCAPTCHA action](https://developers.google.com/recaptcha/docs/v3#actions). Actions may only contain alphanumeric characters and slashes, and must not be user-specific. |
389
389
  | `:nonce` | Optional. Sets nonce attribute for script. Can be generated via `SecureRandom.base64(32)`. (default: `nil`) |
390
390
  | `:callback` | Name of callback function to call with the token. When `element` is `:input`, this defaults to a function named `setInputWithRecaptchaResponseTokenFor#{sanitize_action(action)}` that sets the value of the hidden input to the token. |
391
- | `:id` | Specify a unique `id` attribute for the `<input>` element if using `element: :input`. (default: `"g-recaptcha-response-"` + `action`) |
392
- | `:name` | Specify a unique `name` attribute for the `<input>` element if using `element: :input`. (default: `g-recaptcha-response[action]`) |
391
+ | `:id` | Specify a unique `id` attribute for the `<input>` element if using `element: :input`. (default: `"g-recaptcha-response-data-"` + `action`) |
392
+ | `:name` | Specify a unique `name` attribute for the `<input>` element if using `element: :input`. (default: `g-recaptcha-response-data[action]`) |
393
393
  | `:script` | Same as setting both `:inline_script` and `:external_script`. (default: `true`). |
394
394
  | `:inline_script` | If `true`, adds an inline script tag that calls `grecaptcha.execute` for the given `site_key` and `action` and calls the `callback` with the resulting response token. Pass `false` if you want to handle calling `grecaptcha.execute` yourself. (default: `true`) |
395
395
  | `:element` | The element to render, if any (default: `:input`)<br/>`:input`: Renders a hidden `<input type="hidden">` tag. The value of this will be set to the response token by the default `setInputWithRecaptchaResponseTokenFor{action}` callback.<br/>`false`: Doesn't render any tag. You'll have to add a custom callback that does something with the token. |
@@ -435,7 +435,7 @@ result_b = verify_recaptcha(action: 'b')
435
435
  ```
436
436
 
437
437
  Because the response tokens for multiple actions may be submitted together in the same request, they
438
- are passed as a hash under `params['g-recaptcha-response']` with the action as the key.
438
+ are passed as a hash under `params['g-recaptcha-response-data']` with the action as the key.
439
439
 
440
440
  It is recommended to pass `external_script: false` on all but one of the calls to
441
441
  `recaptcha` since you only need to include the script tag once for a given `site_key`.
@@ -75,7 +75,7 @@ module Recaptcha
75
75
  # the key.
76
76
  # @return [String] A response token if one was passed in the params; otherwise, `''`
77
77
  def recaptcha_response_token(action = nil)
78
- response_param = params['g-recaptcha-response']
78
+ response_param = params['g-recaptcha-response-data']
79
79
  if response_param&.respond_to?(:to_h) # Includes ActionController::Parameters
80
80
  response_param[action].to_s
81
81
  else
@@ -10,8 +10,8 @@ module Recaptcha
10
10
  def self.recaptcha_v3(options = {})
11
11
  site_key = options[:site_key] ||= Recaptcha.configuration.site_key!
12
12
  action = options.delete(:action) || raise(Recaptcha::RecaptchaError, 'action is required')
13
- id = options.delete(:id) || "g-recaptcha-response-" + dasherize_action(action)
14
- name = options.delete(:name) || "g-recaptcha-response[#{action}]"
13
+ id = options.delete(:id) || "g-recaptcha-response-data-" + dasherize_action(action)
14
+ name = options.delete(:name) || "g-recaptcha-response-data[#{action}]"
15
15
  turbolinks = options.delete(:turbolinks)
16
16
  options[:render] = site_key
17
17
  options[:script_async] ||= false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Recaptcha
4
- VERSION = '5.3.0'
4
+ VERSION = '5.4.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.3.0
4
+ version: 5.4.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-01-10 00:00:00.000000000 Z
11
+ date: 2020-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json