login-control 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/login_control_module.rb +13 -2
- data/lib/login_control_view_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a0041b25da378a40ee536b9689846301d6b13eb062f2001fae995a78540094
|
4
|
+
data.tar.gz: b40069097f5b5d8e3bf2025ae63a1b3e88c4adb8a1e07c2771aa389aba4a8941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 130e57bb3dc647f3785c3e1dc295e1ecc57f50359579cc516ca2b1b1ce80adc152200071bd0394e20508910b91e575769b37a076e56cec23f9c6860867a66c76
|
7
|
+
data.tar.gz: 7fa194e79c11dc09897c99412d26d3b9c16f902349e931d1f8f27ce2404262f060ed115e0cc9a4f0ab2f44b7db3d6a1afaf766f888a8c24287b973f9812828bb
|
data/lib/login_control_module.rb
CHANGED
@@ -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
|
-
|
7
|
-
|
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.
|
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-
|
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.
|