card-mod-recaptcha 0.11.3 → 0.11.7

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: c87952360c9ef633cd639da2696e46d54faf955dc40e1c1c4b634402ad54fa05
4
- data.tar.gz: 1370e2ac3c542033aa70402a8dcdb29d452827b3deaa65b6aee5386c2d39f4ec
3
+ metadata.gz: 53490bd36f3f848a59c60eb42a73a1a68bb7a0f6cbde799e61de968615413410
4
+ data.tar.gz: e769b26cef7d20b47b697167c35518221553085b8983ca25f812daf9b3864b95
5
5
  SHA512:
6
- metadata.gz: 17e2c27a75d030ae141ed00408fa804e530a17ec6ad139cd70465300b715ef50a139a498be93eeb3af34ed588664c88393dabbfd7cb5d0e2487c8afdc9f800e8
7
- data.tar.gz: 784abd828741750f6a927e9cd44006b00688326704428250016fe2f1da46c43954f3d44422254c32a8e678770d8f0468ce40ff661dfc99545a4efcd0bd79a6b5
6
+ metadata.gz: ec1146f5d42bb888659a21e29d87346fcce374cdf05db5597cfcae3f27e5d68cf67a33f43b5d996ba61f79f7e7ab4f4287c4de78c6343263f5fac2c1bf86a10f
7
+ data.tar.gz: 48ee0afd27deef74202921ad9d3750696eab73deb1bc623facd50a7207255f45f4a88feeafc569346460a676f9abf4a52c4a17278e0aa3764c9b948031d121b6
@@ -1,4 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
+
2
3
  require "recaptcha"
3
4
 
4
5
  # This initializer module is mostly here to avoid adding methods/vars to the Object
@@ -39,6 +40,7 @@ module RecaptchaCard
39
40
 
40
41
  def card_value setting
41
42
  return unless Card::Codename.exist? setting # prevents breakage in migrations
43
+
42
44
  value = Card[setting]&.content
43
45
  value if value.present?
44
46
  end
@@ -53,3 +55,5 @@ ActiveSupport.on_load :after_card do
53
55
  config.verify_url = "https://www.google.com/recaptcha/api/siteverify"
54
56
  end
55
57
  end
58
+
59
+ CardController.include ::Recaptcha::Verify
data/set/all/recaptcha.rb CHANGED
@@ -33,9 +33,9 @@ def add_recaptcha_errors error_codes
33
33
  end
34
34
 
35
35
  def recaptcha_success? result
36
- result['success'] &&
37
- (result['score'].to_f >= Cardio.config.recaptcha_minimum_score) &&
38
- (result['action'].to_sym == action.to_sym)
36
+ result["success"] &&
37
+ (result["score"].to_f >= Cardio.config.recaptcha_minimum_score) &&
38
+ (result["action"].to_sym == action.to_sym)
39
39
  end
40
40
 
41
41
  def recaptcha_response
@@ -55,16 +55,16 @@ event :recaptcha, :validate, when: :validate_recaptcha? do
55
55
  end
56
56
 
57
57
  def handle_recaptcha_config_errors
58
- if Env.params[:recaptcha_token] == "grecaptcha-undefined"
58
+ case Env.params[:recaptcha_token]
59
+ when "grecaptcha-undefined"
59
60
  errors.add "recaptcha", "needs correct v3 configuration" # LOCALILZE
60
- elsif Env.params[:recaptcha_token] == "recaptcha-token-field-missing"
61
+ when "recaptcha-token-field-missing"
61
62
  raise Card::Error, "recaptcha token field missing" # LOCALILZE
62
63
  else
63
64
  yield
64
65
  end
65
66
  end
66
67
 
67
-
68
68
  def validate_recaptcha?
69
69
  !@supercard && !Env[:recaptcha_used] && recaptcha_on?
70
70
  end
@@ -11,17 +11,17 @@ format :html do
11
11
  # %(Your captcha is currently working with temporary settings.
12
12
  # This is fine for a local installation, but you will need new
13
13
  # recaptcha keys if you want to make this site public.)
14
- tr :captcha_temp, recaptcha_link: add_recaptcha_keys_link
14
+ t :recaptcha_captcha_temp, recaptcha_link: add_recaptcha_keys_link
15
15
  else
16
16
  # %(You are configured to use [[*captcha]], but for that to work
17
17
  # you need new recaptcha keys.)
18
- tr :captcha_keys, recaptcha_link: add_recaptcha_keys_link,
19
- captcha_link: link_to_card(:captcha)
18
+ t :recaptcha_captcha_keys, recaptcha_link: add_recaptcha_keys_link,
19
+ captcha_link: link_to_card(:captcha)
20
20
  end
21
21
  end
22
22
  end
23
23
 
24
24
  def add_recaptcha_keys_link
25
- Card[:recaptcha_settings]&.format&.edit_link link_text: tr(:recaptcha_keys)
25
+ Card[:recaptcha_settings]&.format&.edit_link link_text: t(:recaptcha_captcha_keys)
26
26
  end
27
27
  end
@@ -0,0 +1,5 @@
1
+ setting_opts group: :permission,
2
+ position: 5,
3
+ help_text: "Anti-spam setting. Requires non-signed-in users to complete a "\
4
+ "[[http://decko.org/captcha|captcha]] before adding or editing "\
5
+ "cards (where permitted)."
@@ -12,19 +12,20 @@ format :html do
12
12
  # end
13
13
  #
14
14
  # <h5>#{instructions}</h5>
15
- # #{howto_add_new_recaptcha_keys}
15
+ # #{howto_add_keys}
16
16
  # #{howto_turn_captcha_off}
17
17
  #
18
18
  # def howto_add_new_recaptcha_keys
19
- # instructions tr(:howto_add_keys),
20
- # [tr(:howto_register,
21
- # recaptcha_link: link_to_resource("http://google.com/recaptcha")),
22
- # tr(:howto_add, recaptcha_settings: link_to_card(:recaptcha_settings))]
19
+ # instructions t(:recaptcha_howto_add_keys),
20
+ # [t(:recaptcha_howto_register,
21
+ # recaptcha_link: link_to_resource("http://google.com/recaptcha")),
22
+ # t(:recaptcha_howto_add,
23
+ # recaptcha_settings: link_to_card(:recaptcha_settings))]
23
24
  # end
24
25
  #
25
26
  # def howto_turn_captcha_off
26
- # instructions tr(:howto_turn_off),
27
- # [tr(:howto_go, captcha_card: link_to_card(:captcha)),
28
- # tr(:howto_update)]
27
+ # instructions t(:recaptcha_howto_turn_off),
28
+ # [t(:recaptcha_howto_go, captcha_card: link_to_card(:captcha)),
29
+ # t(:recaptcha_howto_update)]
29
30
  # end
30
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-recaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-01 00:00:00.000000000 Z
13
+ date: 2021-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.3
21
+ version: 1.101.7
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.101.3
28
+ version: 1.101.7
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: recaptcha
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -50,6 +50,7 @@ files:
50
50
  - config/initializers/recaptcha.rb
51
51
  - set/all/recaptcha.rb
52
52
  - set/self/admin_info.rb
53
+ - set/self/captcha.rb
53
54
  - set/self/recaptcha_proxy.rb
54
55
  - set/self/recaptcha_secret_key.rb
55
56
  - set/self/recaptcha_settings.rb
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  - !ruby/object:Gem::Version
80
81
  version: '0'
81
82
  requirements: []
82
- rubygems_version: 3.1.4
83
+ rubygems_version: 3.1.6
83
84
  signing_key:
84
85
  specification_version: 4
85
86
  summary: recaptcha support for decko