rails_cloudflare_turnstile 0.2.0 → 0.2.1
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 +4 -0
- data/README.md +1 -1
- data/lib/rails_cloudflare_turnstile/version.rb +1 -1
- data/lib/rails_cloudflare_turnstile/view_helpers.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 756316e7b956c4e4e61943b295fb036a496b6b198233a127b40f4de8db5f16ca
|
4
|
+
data.tar.gz: b2adce2585dee4b6d06d4450b254b35dfdf0098623f674fff9eb0377afa20d1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d83f63d49afc9e6b355a4a661cc59fd03615dff420fc4b4559ce02befd932f0ef1a8e8813d5c0aeffa37df0330d54e6fceab54b7b9c2c6c5aee3f459cc2c63
|
7
|
+
data.tar.gz: e6183c1964960b206d38d5a5f7530d40da406746e2b8f678e579c98c4a6354c168f6cda21a2aa09d91d0c0f2959ec31e409a7f3a9cf89ad8835665f74809293a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,7 @@ To totally disable Turnstile, you can set `c.enabled = false` and all other conf
|
|
38
38
|
To use Turnstile for a view:
|
39
39
|
|
40
40
|
1. Call `cloudflare_turnstile_script_tag` in your layout
|
41
|
-
2. Call `cloudflare_turnstile` in your form View
|
41
|
+
2. Call `cloudflare_turnstile` in your form View. Keyword arguments are passed to the tag helper (for example, to set the `tabindex` option, you could use `cloudflare_turnstile(data: {tabindex: 0})`)
|
42
42
|
3. Call `validate_cloudflare_turnstile` as a `before_action` in your controller.
|
43
43
|
|
44
44
|
If the challenge fails, the exception `RailsCloudflareTurnstile::Forbidden` will be raised; you should handle this with
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module RailsCloudflareTurnstile
|
4
4
|
module ViewHelpers
|
5
|
-
def cloudflare_turnstile(action: "other", data_callback: nil)
|
5
|
+
def cloudflare_turnstile(action: "other", data_callback: nil, **html_options)
|
6
6
|
if RailsCloudflareTurnstile.enabled?
|
7
7
|
content_tag(:div, class: "cloudflare-turnstile") do
|
8
|
-
concat turnstile_div(action, data_callback: data_callback)
|
8
|
+
concat turnstile_div(action, data_callback: data_callback, **html_options)
|
9
9
|
end
|
10
10
|
elsif RailsCloudflareTurnstile.mock_enabled?
|
11
11
|
content_tag(:div, class: "cloudflare-turnstile") do
|
12
|
-
concat mock_turnstile_div(action, data_callback: data_callback)
|
12
|
+
concat mock_turnstile_div(action, data_callback: data_callback, **html_options)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -28,15 +28,15 @@ module RailsCloudflareTurnstile
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def turnstile_div(action, data_callback: nil)
|
31
|
+
def turnstile_div(action, data_callback: nil, **html_options)
|
32
32
|
config = RailsCloudflareTurnstile.configuration
|
33
|
-
content_tag(:div, :class => "cf-turnstile", "data-sitekey" => site_key, "data-size" => config.size, "data-action" => action, "data-callback" => data_callback, "data-theme" => config.theme) do
|
33
|
+
content_tag(:div, :class => "cf-turnstile", "data-sitekey" => site_key, "data-size" => config.size, "data-action" => action, "data-callback" => data_callback, "data-theme" => config.theme, **html_options) do
|
34
34
|
""
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def mock_turnstile_div(action, data_callback: nil)
|
39
|
-
content_tag(:div, :class => "cf-turnstile", :style => "width: 300px; height: 65px; border: 1px solid gray; display: flex; flex-direction: row; justify-content: center; align-items: center; margin: 10px;", "data-callback" => data_callback) do
|
38
|
+
def mock_turnstile_div(action, data_callback: nil, **html_options)
|
39
|
+
content_tag(:div, :class => "cf-turnstile", :style => "width: 300px; height: 65px; border: 1px solid gray; display: flex; flex-direction: row; justify-content: center; align-items: center; margin: 10px;", "data-callback" => data_callback, **html_options) do
|
40
40
|
[
|
41
41
|
tag.input(type: "hidden", name: "cf-turnstile-response", value: "mocked"),
|
42
42
|
image_tag("turnstile-logo.svg"),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_cloudflare_turnstile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
|
-
rubygems_version: 3.5.
|
97
|
+
rubygems_version: 3.5.9
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Rails extension for Cloudflare's Turnstile CAPTCHA alternative
|