recaptcha 5.14.0 → 5.15.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/recaptcha/version.rb +1 -1
- data/lib/recaptcha.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: addd45d783c834ffbc2253f3b7df793762ffb839617315d6cfd17e7d5abec519
|
4
|
+
data.tar.gz: 1795b9d183326d23f408b5dd2b595531ff504885797012aa51953c6efc73a29d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddccc592d5d0ecdf7bae96d6a68ea29085dcdbfad9b346ae761a50d8b5b4c9f5337946e4e4374af4a1f74a2d8efd1e90e7a517f933f89f71a0cf3a1add44e701
|
7
|
+
data.tar.gz: 9b3fc098f10c2a53798adaebca95b60a0e54b6188275dd388afd3fb160ff881caf7724e57c9063478c08d7b8e3f268e952aefc413bf2e3e2ab4bdf7c13a4b0a4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -181,6 +181,7 @@ Some of the options available:
|
|
181
181
|
| `:response` | Custom response parameter. (default: `params['g-recaptcha-response-data']`)
|
182
182
|
| `: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`)
|
183
183
|
| `:env` | Current environment. The request to verify will be skipped if the environment is specified in configuration under `skip_verify_env`
|
184
|
+
| `:json` | Boolean; defaults to false; if true, will submit the verification request by POST with the request data in JSON
|
184
185
|
|
185
186
|
|
186
187
|
### `invisible_recaptcha_tags`
|
data/lib/recaptcha/version.rb
CHANGED
data/lib/recaptcha.rb
CHANGED
@@ -98,7 +98,7 @@ module Recaptcha
|
|
98
98
|
verify_hash = { 'secret' => secret_key, 'response' => response }
|
99
99
|
verify_hash['remoteip'] = options[:remote_ip] if options.key?(:remote_ip)
|
100
100
|
|
101
|
-
reply = api_verification_free(verify_hash, timeout: options[:timeout])
|
101
|
+
reply = api_verification_free(verify_hash, timeout: options[:timeout], json: options[:json])
|
102
102
|
success = reply['success'].to_s == 'true' &&
|
103
103
|
hostname_valid?(reply['hostname'], options[:hostname]) &&
|
104
104
|
action_valid?(reply['action'], options[:action]) &&
|
@@ -152,11 +152,18 @@ module Recaptcha
|
|
152
152
|
instance
|
153
153
|
end
|
154
154
|
|
155
|
-
def self.api_verification_free(verify_hash, timeout: nil)
|
156
|
-
|
157
|
-
|
155
|
+
def self.api_verification_free(verify_hash, timeout: nil, json: false)
|
156
|
+
if json
|
157
|
+
uri = URI.parse(configuration.verify_url)
|
158
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
159
|
+
request['Content-Type'] = 'application/json; charset=utf-8'
|
160
|
+
request.body = JSON.generate(verify_hash)
|
161
|
+
else
|
162
|
+
query = URI.encode_www_form(verify_hash)
|
163
|
+
uri = URI.parse("#{configuration.verify_url}?#{query}")
|
164
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
165
|
+
end
|
158
166
|
http_instance = http_client_for(uri: uri, timeout: timeout)
|
159
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
160
167
|
JSON.parse(http_instance.request(request).body)
|
161
168
|
end
|
162
169
|
|
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.
|
4
|
+
version: 5.15.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: 2023-
|
11
|
+
date: 2023-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mocha
|