login-control 0.0.14 → 0.0.16

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: 79173cf05ae33b909d18f5d0133cc5f5923a441eaac6a97c46f7014954366b78
4
- data.tar.gz: 4b397e66649e66d8f5e46f396869cf7dd509fbbff0fdba3f03fd350dc70d49c0
3
+ metadata.gz: f8a0041b25da378a40ee536b9689846301d6b13eb062f2001fae995a78540094
4
+ data.tar.gz: b40069097f5b5d8e3bf2025ae63a1b3e88c4adb8a1e07c2771aa389aba4a8941
5
5
  SHA512:
6
- metadata.gz: b76a4df603b6c1ae5fef560f30fa75f4727a8775109c1e4546a23c3a19d4cb10900680d4b2a8f22ee2da5112bfad9dbce48f8fc49c7ef8a8a608fa8275a073a8
7
- data.tar.gz: 00e6e60b838174b6d380757bb76855c403b450bca000fab74820b93269fbbce3d1790927cd110f3fc39f34c3c27ecff00847750c52059db473392d035a886ae3
6
+ metadata.gz: 130e57bb3dc647f3785c3e1dc295e1ecc57f50359579cc516ca2b1b1ce80adc152200071bd0394e20508910b91e575769b37a076e56cec23f9c6860867a66c76
7
+ data.tar.gz: 7fa194e79c11dc09897c99412d26d3b9c16f902349e931d1f8f27ce2404262f060ed115e0cc9a4f0ab2f44b7db3d6a1afaf766f888a8c24287b973f9812828bb
@@ -3,8 +3,19 @@ module LoginControlModule
3
3
  # check if captcha is to validate (does not store a cookie)
4
4
  def captcha_validation?(scope: :global, login_name: nil)
5
5
  rec = rc_record(scope, login_name)
6
- logger.info "LoginControlModule => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
7
- rec ? rec.validate_captcha : true
6
+ if request.host == 'localhost'
7
+ logger.info "LoginControlModule => get captcha NOT requested because localhost" if debug_request_control
8
+ false
9
+ elsif Rails.env.development? || Rails.env == 'test'
10
+ logger.info "LoginControlModule => get captcha NOT requested because Rails.env #{Rails.env}" if debug_request_control
11
+ false
12
+ elsif rec
13
+ logger.info "LoginControlModule => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
14
+ rec.validate_captcha
15
+ else
16
+ logger.info "LoginControlModule => get captcha requested (all other conditions failed)" if debug_request_control
17
+ true
18
+ end
8
19
  end
9
20
 
10
21
  # stores cookie, count-up sign_in_success, set attempts count to 1
@@ -43,8 +43,8 @@ module LoginControlViewHelper
43
43
  end
44
44
  rec.update!(validate_captcha: captcha_requested)
45
45
  logger.info "LoginControlViewHelper.captcha_tag? => set captcha #{captcha_requested ? '' : 'NOT '}requested to record LoginControl.#{rec.id}" if debug
46
- captcha_requested
47
46
  end
47
+ captcha_requested
48
48
  end
49
49
 
50
50
  # Text for ask a user for storing a cookie
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: login-control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-13 00:00:00.000000000 Z
11
+ date: 2023-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Based on Login Attempts check if captcha is necessary. It stores a permanent
14
14
  cookie and uses a table for tracking login requests.