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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6777f6f63ac40c41259b01aa9fd0870a7a237eeb
4
- data.tar.gz: cbc52ee213e80fe5f91f0eaee67a29136711e7c4
3
+ metadata.gz: 6d97798a175e48327e1aea8ee6e57c1ea9a31cf8
4
+ data.tar.gz: 5648bc8af9271450af13692d0d519b0d4aa65c01
5
5
  SHA512:
6
- metadata.gz: b9cef651b3b821ffcdf0677269e11daa1d124833b502103c1f7a363ecbede85c039f6a9efcdd0ca176291eb04b930e9c990d8c78171b4d0374247335bfb73d9d
7
- data.tar.gz: 95afed7cac033e9fb53ad5cddfbc9fa61348609dd5b75512561ad55e8a7c32c9c2091081ae60f3a4102d4a4cc990680d679d10e5ae68742dc0654de0488ae320
6
+ metadata.gz: 95f50723630205780a74ee7ad28a6496e80dd903ed6be311ef287c5cc986a1c5f3b81cdd2ec8f2360d3ccceca220bc2fe46d2579a080713cab67737cc3a04531
7
+ data.tar.gz: 01348b45a9933b3abbe1c2f9d5f16b7800145a31cc298cbe035e62136ed231ad6584b476c670c2e1fa2ccc27e7ef6b60fbbb46f08d0995ce71a6142e6f932139
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Recaptcha
2
- VERSION = "4.4.1".freeze
2
+ VERSION = "4.5.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.4.1
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-09-08 00:00:00.000000000 Z
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json