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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 514874151c3eb8e360abc5dfa43ebbf2f154d2ca1d449d8594cadf2ca5d73e97
4
- data.tar.gz: 8859da940e28f21beb58521361b28afead517f5dca8187e5cabfb81fe10d35be
3
+ metadata.gz: 769e065383197f530066e6829c35e299bf532ed20f75fd231dd232a4fb56366e
4
+ data.tar.gz: 8c63515f7009f0c0237abb4ad0532656a8f6accb84752692ba8f038dc5af9778
5
5
  SHA512:
6
- metadata.gz: 738e13bd0c4f53dff85f683bf68de9e871dc727d7d8e814f3765f01459aad59c0177fd580f4b1288d60ac469c81511880c51d98bc34ed4c43875a3f1c9e63a15
7
- data.tar.gz: f579fe56b1ae81c0c94b1cf09e1cf91402fae35e3b7e9b0600032474152421a1b852db6aaa5f7d202589ec8add27da3a9b79e38f7bc0a084e748e6e4dc775052
6
+ metadata.gz: c275f07aeadbbf8e6eaca7a5fc30b6ab057cf2d51dde5de5e8be742bda9de1810ad797de5eda5308ced8d9a39a1799cd46d43687253ef1f1252dc12eb237a2b0
7
+ data.tar.gz: 64ecabe548173dd21c0412ff4c92f4a50d1bbf35616c380baa0fdbf356b2cb86e86ce1625868c7a10e2e72c26e6380755cb2bf437b97b1dca29c541eedd715e9
@@ -1,3 +1,9 @@
1
+ ## 4.12.0 - 2018-08-30
2
+ * add `input` option to `invisible_recaptcha_tags`'s `ui` setting
3
+
4
+ ## 4.11.1 - 2018-08-08
5
+ * leave `tabindex` attribute alone for `invisible_recaptcha_tags`
6
+
1
7
  ## 4.11.0 - 2018-08-06
2
8
  * prefer RAILS_ENV over RACK_ENV #286
3
9
 
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 = ''.dup
70
+ html = +''
71
71
  attributes = {}
72
- fallback_uri = ''.dup
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).to_s
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
- script_url += "?hl=#{hl}" unless hl == ""
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
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # deprecated, but let's not blow everyone up
3
4
  require 'recaptcha'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Recaptcha
4
- VERSION = '4.12.0'
4
+ VERSION = '4.13.0'
5
5
  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.12.0
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-08-30 00:00:00.000000000 Z
11
+ date: 2018-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json