devise-cloudflare-turnstile 0.12.1 → 0.12.2

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: 471aea45843200703b848a8aacef060af2362f7103fae9f417df4f9e092bae12
4
- data.tar.gz: a33a85702790274610f4580978a446037f5c468680a0128517105d14f58d9061
3
+ metadata.gz: 9be86bd9bc783a6287f049c134ba5267f4b78f3414f4bf8f2ec0b6d0c30b6c85
4
+ data.tar.gz: e0f4678b0668e47801a35f67581acf076512d74054461d1dfda44b4e80269d69
5
5
  SHA512:
6
- metadata.gz: b4ada2a98896212e2b0d0c60ac5f81cbf0c56cd204c026273617eefec30aece67b114f6809d2cf81261876c6ac77c4348972dbd0abd48f3e3c7d7794697bc9da
7
- data.tar.gz: e57e4598eec7ea12bfbad15dfe25855322e0b9d48cef81114b49ef5b66115c6e063f8c7b9bc28a68a5e29390a4c54c58aaf3f7eabc5eeebc000170d059ee55a9
6
+ metadata.gz: b212f30b5dc70e328a25a5e1a5345497c2ecdbe8a84416bf5db93d8f58bd60c4e11b322b4fd0eb7922e0baec448ff7f40473c0ca52bf71095c819c172c13b1e3
7
+ data.tar.gz: 4beb91ef50ca21a48b1b0f83de932eeab282802201b9edf76da70898077f10847c428d17023d070809de3c55c96af71432356d0b0bb05433f53e338a09391440
@@ -12,16 +12,14 @@ module Cloudflare
12
12
  end
13
13
 
14
14
  # Registers Devise controllers/actions that should not be protected.
15
+ # Repeated calls for the same controller accumulate.
15
16
  #
16
17
  # config.skip :confirmations # every action
17
18
  # config.skip passwords: :create # a single action
18
19
  # config.skip unlocks: [:new, :create] # a set of actions
19
20
  def skip(*controllers, **controller_actions)
20
- controllers.each { |controller| skips[controller.to_s] = :all }
21
-
22
- controller_actions.each do |controller, actions|
23
- skips[controller.to_s] = Array(actions).map(&:to_s)
24
- end
21
+ controllers.each { |controller| skip_named(controller) }
22
+ controller_actions.each { |controller, actions| skip_actions(controller.to_s, actions) }
25
23
  end
26
24
 
27
25
  def skipped?(controller_name, action_name)
@@ -31,6 +29,21 @@ module Cloudflare
31
29
 
32
30
  rule.include?(action_name.to_s)
33
31
  end
32
+
33
+ private
34
+
35
+ # Ruby 2.6 passes a string-key hash as a positional argument, not as keywords.
36
+ def skip_named(controller)
37
+ return skips[controller.to_s] = :all unless controller.is_a?(Hash)
38
+
39
+ controller.each { |name, actions| skip_actions(name.to_s, actions) }
40
+ end
41
+
42
+ def skip_actions(controller, actions)
43
+ return if skips[controller] == :all
44
+
45
+ skips[controller] = Array(skips[controller]) | Array(actions).map(&:to_s)
46
+ end
34
47
  end
35
48
  end
36
49
  end
@@ -1,7 +1,7 @@
1
1
  module Devise
2
2
  module Cloudflare
3
3
  module Turnstile
4
- VERSION = '0.12.1'.freeze
4
+ VERSION = '0.12.2'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-cloudflare-turnstile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Kononov
@@ -37,8 +37,9 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '4.0'
40
- description: Automatically protect Devise authentication forms with Cloudflare Turnstile,
41
- without changing your Devise views or controllers.
40
+ description: Drop-in Cloudflare Turnstile CAPTCHA, a reCAPTCHA alternative, for Devise
41
+ and Devise extensions. Auto-injected widget with Turbo, Turbolinks, CSP nonce and
42
+ i18n support.
42
43
  email:
43
44
  - vadim@konoson.com
44
45
  executables: []
@@ -81,5 +82,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  requirements: []
82
83
  rubygems_version: 4.0.10
83
84
  specification_version: 4
84
- summary: Cloudflare Turnstile integration for Devise
85
+ summary: Cloudflare Turnstile CAPTCHA for Devise with zero view or controller changes
85
86
  test_files: []