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 +4 -4
- data/config/initializers/recaptcha.rb +4 -0
- data/set/all/recaptcha.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a347dd665fa699579bf67c582ff0996790225b8a6ec20ae93881fa9a6d439172
|
4
|
+
data.tar.gz: fa11e95ef7d7ef20065e99d70610b908ee27d0fcaf5418778594912e6cdec57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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[
|
37
|
-
(result[
|
38
|
-
(result[
|
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
|
-
|
58
|
+
case Env.params[:recaptcha_token]
|
59
|
+
when "grecaptcha-undefined"
|
59
60
|
errors.add "recaptcha", "needs correct v3 configuration" # LOCALILZE
|
60
|
-
|
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
|
+
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-
|
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.
|
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.
|
28
|
+
version: 1.101.5
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: recaptcha
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|