card-mod-recaptcha 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/init/late/recaptcha.rb +59 -0
- data/locales/en.yml +9 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e074e697c924695550d3ad018f495223a7ed51f9191c6c8c2f5ecc0615353b9
|
4
|
+
data.tar.gz: 1851ce86647f9c47d875ca9c05eba8467b33f7f5e89b4dd20e436dcc6c24c2ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be552cc2a89f238128a42f16d1dbda8b5bf6bc8bac0ab5faaa5c6ffefe7a501670f1186feff0a3ce192a7a7f61f82884e22ad8da68d67ac98dd644c4b55483f0
|
7
|
+
data.tar.gz: 4690d2e675ad4cf4eed8d72da822d0692cc67a41d2ddac47535f7e10b3c796ca6fa8fde15e2a7c6d33606c63f8aface14a6cf10a12236e9d4867d228984303e4
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
require "recaptcha"
|
4
|
+
|
5
|
+
# This initializer module is mostly here to avoid adding methods/vars to the Object
|
6
|
+
# namespace
|
7
|
+
module RecaptchaCard
|
8
|
+
@deprecated = {
|
9
|
+
recaptcha_site_key: :recaptcha_public_key,
|
10
|
+
recaptcha_secret_key: :recaptcha_private_key
|
11
|
+
}
|
12
|
+
@defaults = {
|
13
|
+
recaptcha_site_key: "6LdoqpgUAAAAAEdhJ4heI1h3XLlpXcDf0YubriCG",
|
14
|
+
recaptcha_secret_key: "6LdoqpgUAAAAAP4Sz1L5PY6VKrum_RFxq4-awj4BH"
|
15
|
+
}
|
16
|
+
|
17
|
+
mattr_accessor :using_card_defaults
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def load_recaptcha_config setting
|
21
|
+
setting = "recaptcha_#{setting}".to_sym
|
22
|
+
Cardio.config.send "#{setting}=", recaptcha_setting_value(setting)
|
23
|
+
end
|
24
|
+
|
25
|
+
def using_defaults?
|
26
|
+
Cardio.config.recaptcha_site_key == @defaults[:recaptcha_site_key]
|
27
|
+
end
|
28
|
+
|
29
|
+
# card config overrides application.rb config overrides default
|
30
|
+
def recaptcha_setting_value setting
|
31
|
+
card_value(setting) || # card content
|
32
|
+
config_value(setting) || # application.rb (current setting)
|
33
|
+
config_value(@deprecated[setting]) || # application.rb (deprecated setting)
|
34
|
+
@defaults[setting]
|
35
|
+
end
|
36
|
+
|
37
|
+
def config_value setting
|
38
|
+
Cardio.config.send setting
|
39
|
+
end
|
40
|
+
|
41
|
+
def card_value setting
|
42
|
+
return unless Card::Codename.exist? setting # prevents breakage in migrations
|
43
|
+
|
44
|
+
value = Card[setting]&.content
|
45
|
+
value if value.present?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
ActiveSupport.on_load :after_card do
|
51
|
+
Recaptcha.configure do |config|
|
52
|
+
%i[site_key secret_key].each do |setting|
|
53
|
+
config.send "#{setting}=", RecaptchaCard.load_recaptcha_config(setting)
|
54
|
+
end
|
55
|
+
config.verify_url = "https://www.google.com/recaptcha/api/siteverify"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
CardController.include ::Recaptcha::Verify
|
data/locales/en.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
en:
|
2
|
+
recaptcha_captcha_keys: You are configured to use %{captcha_link}, but for that to work you need new %{recaptcha_link}.
|
3
|
+
recaptcha_captcha_temp: Your captcha is currently working with temporary settings. This is fine for a local installation, but you will need new %{recaptcha_link} if you want to make this site public.
|
4
|
+
recaptcha_howto_add: Add your keys to %{recaptcha_settings}
|
5
|
+
recaptcha_howto_add_keys: "How to add new recaptcha keys:"
|
6
|
+
recaptcha_howto_go: Go to %{captcha_card}
|
7
|
+
recaptcha_howto_register: Register your domain at %{recaptcha_link}
|
8
|
+
recaptcha_howto_turn_off: 'How to turn captcha off:'
|
9
|
+
recaptcha_howto_update: Update all *captcha rules to "no".
|
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.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.103.
|
21
|
+
version: 1.103.2
|
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.103.
|
28
|
+
version: 1.103.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: recaptcha
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,6 +47,8 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- init/late/recaptcha.rb
|
51
|
+
- locales/en.yml
|
50
52
|
- set/all/recaptcha.rb
|
51
53
|
- set/self/admin_info.rb
|
52
54
|
- set/self/captcha.rb
|