card-mod-recaptcha 0.11.1 → 0.11.6

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
2
  SHA256:
3
- metadata.gz: 604e78a3af0d05a4644acece19a7815f32f0e54f69b2c4d2ff494cd704925c6c
4
- data.tar.gz: c0be11d31319b5d2e4ef6e3b5ae8d001e32c9ca09b857528d067f7eb3df200b8
3
+ metadata.gz: 942a3a1cb161b129458b799367870e41a2ae7a6ced5d345f47d0123459b857af
4
+ data.tar.gz: 73deb8c3a2a822cc4199dff4b04158d9f79d4b751df88be688eb355aa844e846
5
5
  SHA512:
6
- metadata.gz: 4b24e931bd1b756da764a575c7f9a2eb39d35623be4372245da6326d9e21b30de1a2840752c51ecd362347937920d708be2407c71ab84811410a991aba583ac9
7
- data.tar.gz: 24285c59887bdb2cef238fddd0918d55595b8e4cde1cf3cbd2f9ed408b0593ef8699fa6a7b54d6ebb297089b592687b6d7c13cc586b19536cef625b142b6d946
6
+ metadata.gz: 708c271e374709066a21319414bbd32a4a9fca9d35ef2583f10076a5e04a4b5ad42a75e6d686ff9a2f574525951405a1c5ece49dcb72868e63e4e1f3ca025d16
7
+ data.tar.gz: '00597b202ddd79e86ba13ca25a57ac477915f8916c40861f7dd022c97757c3fb05d57e96915766ad818a19c8427e44aed57de48db89cd141278c6656729d1bdf'
@@ -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
@@ -6,27 +6,22 @@ end
6
6
 
7
7
  format :html do
8
8
  def recaptcha_config_issues_message
9
- warning =
9
+ wrap_with :p do
10
10
  if Card::Env.localhost?
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
- I18n.t(:captcha_temp, scope: "mod.admin.set.self.admin_info",
15
- recaptcha_link: add_recaptcha_keys_link)
14
+ t :recaptcha_captcha_temp, recaptcha_link: add_recaptcha_keys_link
16
15
  else
17
16
  # %(You are configured to use [[*captcha]], but for that to work
18
17
  # you need new recaptcha keys.)
19
- I18n.t(:captcha_keys, scope: "mod.admin.set.self.admin_info",
20
- recaptcha_link: add_recaptcha_keys_link,
21
- captcha_link: link_to_card(:captcha))
18
+ t :recaptcha_captcha_keys, recaptcha_link: add_recaptcha_keys_link,
19
+ captcha_link: link_to_card(:captcha)
22
20
  end
23
- <<-HTML
24
- <p>#{warning}</p>
25
- HTML
21
+ end
26
22
  end
27
23
 
28
24
  def add_recaptcha_keys_link
29
- link_text = I18n.t :recaptcha_keys, scope: "mod.admin.set.self.admin_info"
30
- Card[:recaptcha_settings]&.format&.edit_link link_text: link_text
25
+ Card[:recaptcha_settings]&.format&.edit_link link_text: t(:recaptcha_captcha_keys)
31
26
  end
32
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,33 +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(
20
- # I18n.t(:howto_add_keys, scope: "mod.admin.set.self.admin_info"),
21
- # [
22
- # I18n.t(:howto_register,
23
- # scope: "mod.admin.set.self.admin_info",
24
- # recaptcha_link: link_to_resource("http://google.com/recaptcha")),
25
- # I18n.t(:howto_add,
26
- # scope: "mod.admin.set.self.admin_info",
27
- # recaptcha_settings: link_to_card(:recaptcha_settings))
28
- # ]
29
- # )
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))]
30
24
  # end
31
25
  #
32
26
  # def howto_turn_captcha_off
33
- # instructions(
34
- # I18n.t(:howto_turn_off, scope: "mod.admin.set.self.admin_info"),
35
- # [
36
- # I18n.t(:howto_go,
37
- # scope: "mod.admin.set.self.admin_info",
38
- # captcha_card: link_to_card(:captcha)),
39
- # I18n.t(:howto_update,
40
- # scope: "mod.admin.set.self.admin_info")
41
- # ]
42
- # )
27
+ # instructions t(:recaptcha_howto_turn_off),
28
+ # [t(:recaptcha_howto_go, captcha_card: link_to_card(:captcha)),
29
+ # t(:recaptcha_howto_update)]
43
30
  # end
44
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.1
4
+ version: 0.11.6
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-03-02 00:00:00.000000000 Z
13
+ date: 2021-05-21 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.1
21
+ version: 1.101.6
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.1
28
+ version: 1.101.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: recaptcha
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +50,20 @@ 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
56
57
  - set/self/recaptcha_site_key.rb
57
- homepage: http://decko.org
58
+ homepage: https://decko.org
58
59
  licenses:
59
60
  - GPL-3.0
60
61
  metadata:
62
+ source_code_uri: https://github.com/decko-commons/decko
63
+ homepage_uri: https://decko.org
64
+ bug_tracker_uri: https://github.com/decko-commons/decko/issues
65
+ wiki_uri: https://decko.org
66
+ documentation_url: http://docs.decko.org/
61
67
  card-mod: recaptcha
62
68
  post_install_message:
63
69
  rdoc_options: []
@@ -74,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  requirements: []
77
- rubygems_version: 3.0.3
83
+ rubygems_version: 3.1.4
78
84
  signing_key:
79
85
  specification_version: 4
80
86
  summary: recaptcha support for decko