recaptcha 4.12.0 → 4.13.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 +6 -0
- data/README.md +2 -0
- data/lib/recaptcha/client_helper.rb +15 -4
- data/lib/recaptcha/rails.rb +1 -0
- data/lib/recaptcha/version.rb +1 -1
- 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: 769e065383197f530066e6829c35e299bf532ed20f75fd231dd232a4fb56366e
|
4
|
+
data.tar.gz: 8c63515f7009f0c0237abb4ad0532656a8f6accb84752692ba8f038dc5af9778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c275f07aeadbbf8e6eaca7a5fc30b6ab057cf2d51dde5de5e8be742bda9de1810ad797de5eda5308ced8d9a39a1799cd46d43687253ef1f1252dc12eb237a2b0
|
7
|
+
data.tar.gz: 64ecabe548173dd21c0412ff4c92f4a50d1bbf35616c380baa0fdbf356b2cb86e86ce1625868c7a10e2e72c26e6380755cb2bf437b97b1dca29c541eedd715e9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,8 @@ Some of the options available:
|
|
73
73
|
| :error | Override the error code returned from the reCAPTCHA API (default `nil`)|
|
74
74
|
| :size | Specify a size (default `nil`)|
|
75
75
|
| :hl | Optional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified. (See [language codes](https://developers.google.com/recaptcha/docs/language)) |
|
76
|
+
| :onload | Optional. The name of your callback function to be executed once all the dependencies have loaded. (See [explicit rendering](https://developers.google.com/recaptcha/docs/display#explicit_render))|
|
77
|
+
| :render | Optional. Whether to render the widget explicitly. Defaults to `onload`, which will render the widget in the first g-recaptcha tag it finds. (See [explicit rendering](https://developers.google.com/recaptcha/docs/display#explicit_render))|
|
76
78
|
| :nonce | Optional. Sets nonce attribute for script. Can be generated via `SecureRandom.base64(32)`. (default `nil`)|
|
77
79
|
| :id | Specify an html id attribute (default `nil`)|
|
78
80
|
| :script | If you do not need to add a script tag by helper you can set the option to false. It's necessary when you add a script tag manualy (default `true`)|
|
@@ -67,9 +67,9 @@ module Recaptcha
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def self.recaptcha_components(options = {})
|
70
|
-
html = ''
|
70
|
+
html = +''
|
71
71
|
attributes = {}
|
72
|
-
fallback_uri = ''
|
72
|
+
fallback_uri = +''
|
73
73
|
|
74
74
|
# Since leftover options get passed directly through as tag
|
75
75
|
# attributes, we must unconditionally delete all our options
|
@@ -77,7 +77,9 @@ module Recaptcha
|
|
77
77
|
env = options.delete(:env)
|
78
78
|
class_attribute = options.delete(:class)
|
79
79
|
site_key = options.delete(:site_key)
|
80
|
-
hl = options.delete(:hl)
|
80
|
+
hl = options.delete(:hl)
|
81
|
+
onload = options.delete(:onload)
|
82
|
+
render = options.delete(:render)
|
81
83
|
nonce = options.delete(:nonce)
|
82
84
|
skip_script = (options.delete(:script) == false)
|
83
85
|
ui = options.delete(:ui)
|
@@ -93,7 +95,12 @@ module Recaptcha
|
|
93
95
|
unless Recaptcha::Verify.skip?(env)
|
94
96
|
site_key ||= Recaptcha.configuration.site_key!
|
95
97
|
script_url = Recaptcha.configuration.api_server_url
|
96
|
-
|
98
|
+
query_params = hash_to_query(
|
99
|
+
hl: hl,
|
100
|
+
onload: onload,
|
101
|
+
render: render
|
102
|
+
)
|
103
|
+
script_url += "?#{query_params}" unless query_params.empty?
|
97
104
|
nonce_attr = " nonce='#{nonce}'" if nonce
|
98
105
|
html << %(<script src="#{script_url}" async defer#{nonce_attr}></script>\n) unless skip_script
|
99
106
|
fallback_uri = %(#{script_url.chomp(".js")}/fallback?k=#{site_key})
|
@@ -142,5 +149,9 @@ module Recaptcha
|
|
142
149
|
!Recaptcha::Verify.skip?(options[:env]) &&
|
143
150
|
options[:script] != false
|
144
151
|
end
|
152
|
+
|
153
|
+
private_class_method def self.hash_to_query(hash)
|
154
|
+
hash.delete_if { |_, val| val.nil? || val.empty? }.to_a.map { |pair| pair.join('=') }.join('&')
|
155
|
+
end
|
145
156
|
end
|
146
157
|
end
|
data/lib/recaptcha/rails.rb
CHANGED
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.13.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: 2018-
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|