recaptcha 4.4.1 → 4.5.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/lib/recaptcha/verify.rb +6 -2
- data/lib/recaptcha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d97798a175e48327e1aea8ee6e57c1ea9a31cf8
|
4
|
+
data.tar.gz: 5648bc8af9271450af13692d0d519b0d4aa65c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95f50723630205780a74ee7ad28a6496e80dd903ed6be311ef287c5cc986a1c5f3b81cdd2ec8f2360d3ccceca220bc2fe46d2579a080713cab67737cc3a04531
|
7
|
+
data.tar.gz: 01348b45a9933b3abbe1c2f9d5f16b7800145a31cc298cbe035e62136ed231ad6584b476c670c2e1fa2ccc27e7ef6b60fbbb46f08d0995ce71a6142e6f932139
|
data/lib/recaptcha/verify.rb
CHANGED
@@ -63,19 +63,23 @@ module Recaptcha
|
|
63
63
|
|
64
64
|
def recaptcha_verify_via_api_call(request, recaptcha_response, options)
|
65
65
|
secret_key = options[:secret_key] || Recaptcha.configuration.secret_key!
|
66
|
-
remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
|
67
66
|
|
68
67
|
verify_hash = {
|
69
68
|
"secret" => secret_key,
|
70
|
-
"remoteip" => remote_ip.to_s,
|
71
69
|
"response" => recaptcha_response
|
72
70
|
}
|
73
71
|
|
72
|
+
verify_hash["remoteip"] = remote_ip(request).to_s unless options[:skip_remote_ip]
|
73
|
+
|
74
74
|
reply = JSON.parse(Recaptcha.get(verify_hash, options))
|
75
75
|
reply['success'].to_s == "true" &&
|
76
76
|
recaptcha_hostname_valid?(reply['hostname'], options[:hostname])
|
77
77
|
end
|
78
78
|
|
79
|
+
def remote_ip(request)
|
80
|
+
(request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
|
81
|
+
end
|
82
|
+
|
79
83
|
def recaptcha_hostname_valid?(hostname, validation)
|
80
84
|
validation ||= Recaptcha.configuration.hostname
|
81
85
|
|
data/lib/recaptcha/version.rb
CHANGED
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.
|
4
|
+
version: 4.5.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-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|