card-mod-recaptcha 0.11.4 → 0.11.5

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: ecab662b8babe1c1a18b39fc848a35c9fb28c5ab54efba0b7f9a5d858f0edd60
4
- data.tar.gz: 590c71592f7e5f77ea95a128f0775ed5ee03939627bff8e20745f0c4048d3d18
3
+ metadata.gz: a347dd665fa699579bf67c582ff0996790225b8a6ec20ae93881fa9a6d439172
4
+ data.tar.gz: fa11e95ef7d7ef20065e99d70610b908ee27d0fcaf5418778594912e6cdec57a
5
5
  SHA512:
6
- metadata.gz: c991d7a3056817e5edc7e750f5cb910f9840712d00658493bba2673013dd1f5f738271575d6bfddefdd05ceb98a6cecd4998217dd20d9da1e102909ac1fc848c
7
- data.tar.gz: 94f2489829497985a7bfec569daad7d1472006ae63dbae261441fc2c5f7b08ddc3261ee2dcbc5064715042ad2f334b77defd5addb7d981d311f053677e3816d1
6
+ metadata.gz: e5ecdd6abe5d743b94fd7eac8e851c4106ec78d74a471424057ee2bf4c1a950c1009a9df04b58f6a3b26e0192670ed2fd3188368c0c41a5a52612d3db2d7a3c9
7
+ data.tar.gz: d23661e81fc7f957ddd8e07c0947b3ca067289a6156a3ff3836b8edab6d7203071bc9ad334bab94c50be3b8200e0f143b59130309ceefa0869fabef95ad3577c
@@ -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
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.4
4
+ version: 0.11.5
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-05-05 00:00:00.000000000 Z
13
+ date: 2021-05-10 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.4
21
+ version: 1.101.5
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.4
28
+ version: 1.101.5
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: recaptcha
31
31
  requirement: !ruby/object:Gem::Requirement