recaptcha 2.3.0 → 3.0.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/README.md +0 -2
- data/lib/recaptcha.rb +2 -8
- data/lib/recaptcha/client_helper.rb +3 -2
- data/lib/recaptcha/configuration.rb +3 -19
- 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: e8bf11b481c77b41f01408a1a79f001e1bd7752d
|
|
4
|
+
data.tar.gz: ca7ae6470f682b80d318a919d1b52559c801c593
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f65791a9b97640e4d3080b36f25b5f8c933d18162a5ba711f0379f24c22bd916c3d058d7d00918866bb50c80d9fa1c0e686f3305545b34d39736a77927b2a067
|
|
7
|
+
data.tar.gz: ad562b54afb143099f856fb08d13a46cdf3aa543b3adcdf2455e8c9451427c57a68533dd4f4455aaa7319ee41d3e42751738f5b9e740c7a92593b90696589cb5
|
data/README.md
CHANGED
|
@@ -66,7 +66,6 @@ Some of the options available:
|
|
|
66
66
|
|
|
67
67
|
| Option | Description |
|
|
68
68
|
|-------------|-------------|
|
|
69
|
-
| :ssl | Uses secure http for captcha widget (default `false`, but can be changed by setting `config.use_ssl_by_default`)|
|
|
70
69
|
| :noscript | Include <noscript> content (default `true`)|
|
|
71
70
|
| :display | Takes a hash containing the `theme` and `tabindex` options per the API. (default `nil`), options: 'red', 'white', 'blackglass', 'clean', 'custom'|
|
|
72
71
|
| :ajax | Render the dynamic AJAX captcha per the API. (default `false`)|
|
|
@@ -133,7 +132,6 @@ Recaptcha.configure do |config|
|
|
|
133
132
|
config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
|
|
134
133
|
# Uncomment the following line if you are using a proxy server:
|
|
135
134
|
# config.proxy = 'http://myproxy.com.au:8080'
|
|
136
|
-
# config.disable_ssl_verification # if you do not want to verify ssl connection
|
|
137
135
|
end
|
|
138
136
|
```
|
|
139
137
|
|
data/lib/recaptcha.rb
CHANGED
|
@@ -6,8 +6,7 @@ require 'net/http'
|
|
|
6
6
|
|
|
7
7
|
module Recaptcha
|
|
8
8
|
CONFIG = {
|
|
9
|
-
'server_url' => '
|
|
10
|
-
'secure_server_url' => 'https://www.google.com/recaptcha/api.js',
|
|
9
|
+
'server_url' => 'https://www.google.com/recaptcha/api.js',
|
|
11
10
|
'verify_url' => 'https://www.google.com/recaptcha/api/siteverify'
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -56,12 +55,7 @@ module Recaptcha
|
|
|
56
55
|
uri = URI.parse(Recaptcha.configuration.verify_url + '?' + query)
|
|
57
56
|
http_instance = http.new(uri.host, uri.port)
|
|
58
57
|
http_instance.read_timeout = http_instance.open_timeout = options[:timeout] || DEFAULT_TIMEOUT
|
|
59
|
-
if uri.port == 443
|
|
60
|
-
http_instance.use_ssl = true
|
|
61
|
-
if Recaptcha.configuration.disable_ssl_verification
|
|
62
|
-
http_instance.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
63
|
-
end
|
|
64
|
-
end
|
|
58
|
+
http_instance.use_ssl = true if uri.port == 443
|
|
65
59
|
request = Net::HTTP::Get.new(uri.request_uri)
|
|
66
60
|
http_instance.request(request).body
|
|
67
61
|
end
|
|
@@ -3,10 +3,11 @@ module Recaptcha
|
|
|
3
3
|
# Your public API can be specified in the +options+ hash or preferably
|
|
4
4
|
# using the Configuration.
|
|
5
5
|
def recaptcha_tags(options = {})
|
|
6
|
-
raise(RecaptchaError, "Secure Token is deprecated.") if options
|
|
6
|
+
raise(RecaptchaError, "Secure Token is deprecated.") if options.key?(:stoken)
|
|
7
|
+
raise(RecaptchaError, "SSL is always true.") if options.key?(:ssl)
|
|
7
8
|
public_key = options[:public_key] || Recaptcha.configuration.public_key!
|
|
8
9
|
|
|
9
|
-
script_url = Recaptcha.configuration.api_server_url
|
|
10
|
+
script_url = Recaptcha.configuration.api_server_url
|
|
10
11
|
script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == ""
|
|
11
12
|
fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{public_key}"
|
|
12
13
|
|
|
@@ -28,12 +28,11 @@ module Recaptcha
|
|
|
28
28
|
# end
|
|
29
29
|
#
|
|
30
30
|
class Configuration
|
|
31
|
-
attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :
|
|
31
|
+
attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :hostname
|
|
32
32
|
|
|
33
33
|
def initialize #:nodoc:
|
|
34
34
|
@skip_verify_env = SKIP_VERIFY_ENV
|
|
35
35
|
@handle_timeouts_gracefully = HANDLE_TIMEOUTS_GRACEFULLY
|
|
36
|
-
@use_ssl_by_default = USE_SSL_BY_DEFAULT
|
|
37
36
|
|
|
38
37
|
@private_key = ENV['RECAPTCHA_PRIVATE_KEY']
|
|
39
38
|
@public_key = ENV['RECAPTCHA_PUBLIC_KEY']
|
|
@@ -47,27 +46,12 @@ module Recaptcha
|
|
|
47
46
|
public_key || raise(RecaptchaError, "No public key specified.")
|
|
48
47
|
end
|
|
49
48
|
|
|
50
|
-
def api_server_url
|
|
51
|
-
|
|
52
|
-
key = (ssl ? 'secure_server_url' : 'server_url')
|
|
53
|
-
CONFIG.fetch(key)
|
|
49
|
+
def api_server_url
|
|
50
|
+
CONFIG.fetch('server_url')
|
|
54
51
|
end
|
|
55
52
|
|
|
56
53
|
def verify_url
|
|
57
54
|
CONFIG.fetch('verify_url')
|
|
58
55
|
end
|
|
59
|
-
|
|
60
|
-
def api_version=(v)
|
|
61
|
-
if v == 'v2'
|
|
62
|
-
warn 'setting api_version is deprecated and will be removed shortly, only v2 is supported'
|
|
63
|
-
else
|
|
64
|
-
raise ArgumentError, "only v2 is supported, not #{v.inspect}"
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def api_version
|
|
69
|
-
warn 'getting api_version is deprecated and will be removed shortly, only v2 is supported'
|
|
70
|
-
'v2'
|
|
71
|
-
end
|
|
72
56
|
end
|
|
73
57
|
end
|
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
|
+
version: 3.0.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: 2016-05-
|
|
11
|
+
date: 2016-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|