card-mod-recaptcha 0.13.1 → 0.14.0

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: 3fd159dcbb29e0f174b76ab6a32e0a197ae7f3fa05dc4052422177265d6bdbfc
4
- data.tar.gz: 42eddcec77e69309c3126bf6a92114ac0831361d02a25a8e7051a7f5f0030734
3
+ metadata.gz: 5691d38d9538c4916d88b4c315babc99d63588c7374e9b1ac022d88d72ffb88c
4
+ data.tar.gz: 1a174d8b9d3c50b9d7c8e9744f0b337fbda7cae217532edb203913183ae48c50
5
5
  SHA512:
6
- metadata.gz: 646da375d89aa7e772ef9dc0c3785e18e0821d3bd34f83b040611a5edb8f4856b82e1b7f2744fa10f527b1e280ced1eef4a20ca0d5ca681490aa0fb37980c3f4
7
- data.tar.gz: 9fa222a2939140d6e12c7b6de04471292469c6197bcb3e336f7fa47447ada74953536944975551ae960dae2e165babff4d829c99c5729a07ef1b2e68c9292a16
6
+ metadata.gz: 45c1be05045a6812bac4d020867cc8cded5ad8396106850ab9a35778b499b26b703d332772353864f123d7c3fd74e703ce5c26c8f1ecb7d0f6e8bdd5d98c0510
7
+ data.tar.gz: e5587257faacf48183060f05b9bf53b02b81afd7484301741956a977cac2284483a44423c754d6f2f8f9640bffd9696d3380e9babbc54aa9addb393043482a8b
@@ -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/de.yml ADDED
@@ -0,0 +1,10 @@
1
+ de:
2
+ recaptcha_link_text: Recaptcha-Schlüssel
3
+ recaptcha_captcha_keys: Laut Einstellungen wird %{captcha_link} benutzt, aber damit das funktioniert, benötigen sie neue %{recaptcha_link}.
4
+ recaptcha_captcha_temp: Ihr Captcha läuft im Moment mit temporären Einstellungen. Für eine lokale Installation ist das in Ordnung, aber Sie werden einen neuen %{recaptcha_link} brauchen, wenn Sie diese Seite veröffentlichen.
5
+ recaptcha_howto_add: Fügen Sie ihre Schlüssel zu %{recaptcha_settings} hinzu.
6
+ recaptcha_howto_add_keys: "Wie man neue Recaptcha-Schlüssel hinzufügt:"
7
+ recaptcha_howto_go: Gehe zu %{captcha_card}
8
+ recaptcha_howto_register: Registriere Sie ihre Domain bei %{recaptcha_link}
9
+ recaptcha_howto_turn_off: 'Wie man Captchas ausschaltet:'
10
+ recaptcha_howto_update: Setze alle *captcha-Regel auf "nein".
data/locales/en.yml ADDED
@@ -0,0 +1,10 @@
1
+ en:
2
+ recaptcha_link_text: recaptcha keys
3
+ recaptcha_captcha_keys: You are configured to use %{captcha_link}, but for that to work you need new %{recaptcha_link}.
4
+ 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.
5
+ recaptcha_howto_add: Add your keys to %{recaptcha_settings}
6
+ recaptcha_howto_add_keys: "How to add new recaptcha keys:"
7
+ recaptcha_howto_go: Go to %{captcha_card}
8
+ recaptcha_howto_register: Register your domain at %{recaptcha_link}
9
+ recaptcha_howto_turn_off: 'How to turn captcha off:'
10
+ recaptcha_howto_update: Update all *captcha rules to "no".
@@ -1,4 +1,4 @@
1
- add_to_basket :warnings, :recaptcha_config_issues
1
+ basket[:warnings] << :recaptcha_config_issues
2
2
 
3
3
  def recaptcha_config_issues?
4
4
  RecaptchaCard.using_defaults?
@@ -22,6 +22,6 @@ format :html do
22
22
  end
23
23
 
24
24
  def add_recaptcha_keys_link
25
- Card[:recaptcha_settings]&.format&.edit_link link_text: t(:recaptcha_captcha_keys)
25
+ Card[:recaptcha_settings]&.format&.edit_link link_text: t(:recaptcha_link_text)
26
26
  end
27
27
  end
@@ -3,7 +3,7 @@ format :html do
3
3
  # LOCALIZE
4
4
  "Register your domain at Google's [[http://google.com/recaptcha|reCAPTCHA service]] "\
5
5
  "and enter your site key and secret key below.<br>"\
6
- "If you want to turn catchas off then change all [[*captcha|captcha rules]] to 'no'."
6
+ "If you want to turn captchas off then change all [[*captcha|captcha rules]] to 'no'."
7
7
  end
8
8
 
9
9
  # def instructions title, steps
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.1
4
+ version: 0.14.0
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-08-06 00:00:00.000000000 Z
13
+ date: 2021-12-22 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.103.1
21
+ version: 1.104.0
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.1
28
+ version: 1.104.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: recaptcha
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -47,6 +47,9 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - init/late/recaptcha.rb
51
+ - locales/de.yml
52
+ - locales/en.yml
50
53
  - set/all/recaptcha.rb
51
54
  - set/self/admin_info.rb
52
55
  - set/self/captcha.rb
@@ -79,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
82
  - !ruby/object:Gem::Version
80
83
  version: '0'
81
84
  requirements: []
82
- rubygems_version: 3.1.6
85
+ rubygems_version: 3.2.15
83
86
  signing_key:
84
87
  specification_version: 4
85
88
  summary: recaptcha support for decko