recaptcha 4.6.6 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e59fc75d7cd87f3a83039e06f618122b449d766b
4
- data.tar.gz: f8a49ac6a3498bfc7722f3f0e9d056f5ef853945
2
+ SHA256:
3
+ metadata.gz: 89e73b4d5bdbe1aec048837d3d1dc11d81f18230812e9bc6c112361f629452e3
4
+ data.tar.gz: e549c5fc22aec16de94dace0da38a9b72a225244ee44f5ef51f0b1556b228943
5
5
  SHA512:
6
- metadata.gz: 7eaeb53a2a4cedb9de07e827a720038712e1d5c567dc1624afea6b6e7ac236343bc72b59590639748803eb0da0e2fee7845fa7ca0a61ab29f16d1f43c018889d
7
- data.tar.gz: b2de03b8df392b6aa9995d53e3f9d7096c9021a27179dee45ba1dab29c6ad939271f72e361f6610245b8f5f1001e807f9de918971d1f8ca794c812cf5d16550f
6
+ metadata.gz: 5eef36c932e5f1f3824e046d3a32b2d22f51542b680fa22a163c943b07f34b574eceb9b9b73edf8e4bcd15d01fc97f13eeebfe353a27dfa0bd1968babbb98b1e
7
+ data.tar.gz: 3068c04af8220f5c2eebfa7b1d95757c927b9988b0923de931349303dcf7f569b5a8427357a993578dce30269a47992da529e0f796013f59fc00911bf283a8fc
data/README.md CHANGED
@@ -73,6 +73,7 @@ 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
+ | :nonce | Optional. Sets nonce attribute for script. Can be generated via `SecureRandom.base64(32)`. (default `nil`)|
76
77
  | :id | Specify an html id attribute (default `nil`)|
77
78
  | :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`)|
78
79
 
@@ -68,6 +68,7 @@ module Recaptcha
68
68
  class_attribute = options.delete(:class)
69
69
  site_key = options.delete(:site_key)
70
70
  hl = options.delete(:hl).to_s
71
+ nonce = options.delete(:nonce)
71
72
  skip_script = (options.delete(:script) == false)
72
73
  data_attributes = {}
73
74
  [:badge, :theme, :type, :callback, :expired_callback, :size, :tabindex].each do |data_attribute|
@@ -79,7 +80,8 @@ module Recaptcha
79
80
  site_key ||= Recaptcha.configuration.site_key!
80
81
  script_url = Recaptcha.configuration.api_server_url
81
82
  script_url += "?hl=#{hl}" unless hl == ""
82
- html << %(<script src="#{script_url}" async defer></script>\n) unless skip_script
83
+ nonce_attr = " nonce='#{nonce}'" if nonce
84
+ html << %(<script src="#{script_url}" async defer#{nonce_attr}></script>\n) unless skip_script
83
85
  fallback_uri = %(#{script_url.chomp(".js")}/fallback?k=#{site_key})
84
86
  attributes["data-sitekey"] = site_key
85
87
  attributes.merge! data_attributes
@@ -1,3 +1,3 @@
1
1
  module Recaptcha
2
- VERSION = "4.6.6".freeze
2
+ VERSION = "4.7.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.6.6
4
+ version: 4.7.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-03-05 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.6.14
189
+ rubygems_version: 2.7.3
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Helpers for the reCAPTCHA API