login-control 0.0.10 → 0.0.11

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: 8e5fe55ef77a1e22cb8412309533eb689fad1eb6974a4bc655c90ecbdd9537f8
4
- data.tar.gz: 2ac316f6a3332f45e795b2e5fb70cb842a7a30b98685daa7c009e01dbf09f07c
3
+ metadata.gz: 04536373b256d917d6cfa71c8f75c1b3c0ea1c82b40067a9cdc562b30fdf9fb6
4
+ data.tar.gz: 79725f93e115f88ae440f509795629283d3cf8f7024af1eba5f37ec191a9d8b3
5
5
  SHA512:
6
- metadata.gz: b1dc3fed49863c7173a6333c8a44e8775214596af7d5f2807c97514561c168ef1dc053c52549df4dc0afc247954ae86ced7af133131ce1eeb9921e7ca29e782f
7
- data.tar.gz: c504a82898c66b3658c89469797633f50b050a52699a6afa80bf7ff4cfc8038fc0f1ca7a7ef8ab385b59fe8b1fd89f931e4c83f154130d20c0a7b411a51179b2
6
+ metadata.gz: 633f01b07051b6df77522f40468dbc3af370af527f89fb528f370c91614d9ca4a1ad84266552643e89db8873ca96ac1c3d21086c6dc3cd32289dbfe356d2e8cc
7
+ data.tar.gz: e280825da69501748afb49d94539255166a8758c0cac1fde58bce9eccddb96063ce68e6d9dcc2fcdaa5fe022ef1b1d4843a7fe32ff7ba7b3a7e05a70a1b66481
@@ -3,7 +3,7 @@ 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 "LOGIN-CONTROL => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
6
+ logger.info "LoginControlModule => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
7
7
  rec ? rec.validate_captcha : true
8
8
  end
9
9
 
@@ -15,7 +15,7 @@ module LoginControlModule
15
15
  rec.last_attempt = DateTime.now
16
16
  rec.attempts = 1
17
17
  rec.save!
18
- logger.info "LOGIN-CONTROL => #{rec.sign_in_success}. successful request noticed" if debug_request_control
18
+ logger.info "LoginControlModule.notice_successful_request => #{rec.sign_in_success}. successful request noticed" if debug_request_control
19
19
  end
20
20
 
21
21
  # stores cookie, counts up attempts
@@ -25,7 +25,7 @@ module LoginControlModule
25
25
  rec.attempts = rec.attempts.to_i + 1
26
26
  rec.last_attempt = DateTime.now
27
27
  rec.save!
28
- logger.info "LOGIN-CONTROL => #{rec.attempts}. failed request noticed" if debug_request_control
28
+ logger.info "LoginControlModule.notice_request_attempt => #{rec.attempts}. request attempt noticed" if debug_request_control
29
29
  end
30
30
 
31
31
  private
@@ -8,38 +8,38 @@ module LoginControlViewHelper
8
8
  rc_id = cookies.encrypted.permanent[:login_control]
9
9
  captcha_requested = true
10
10
  if request.host == 'localhost'
11
- logger.info 'LOGIN-CONTROL => no captcha because of localhost' if debug
11
+ logger.info 'LoginControlViewHelper.captcha_tag? => no captcha because of localhost' if debug
12
12
  captcha_requested = false
13
13
  elsif !rc_id.present?
14
- logger.info 'LOGIN-CONTROL => captcha because no cookie stored yet' if debug
14
+ logger.info 'LoginControlViewHelper.captcha_tag? => captcha because no cookie stored yet' if debug
15
15
  captcha_requested = true
16
16
  else
17
- logger.info 'LOGIN-CONTROL => cookie found ...' if debug
17
+ logger.info 'LoginControlViewHelper.captcha_tag? => cookie found ...' if debug
18
18
  rec = LoginControl.find_by(session_id: rc_id, scope: scope, login_name: login_name)
19
19
  if !rec
20
- logger.info 'LOGIN-CONTROL => captcha required because no record found(!)' if debug
20
+ logger.info 'LoginControlViewHelper.captcha_tag? => captcha required because no record found(!)' if debug
21
21
  true
22
22
  else
23
- logger.info 'LOGIN-CONTROL => record found ...' if debug
23
+ logger.info 'LoginControlViewHelper.captcha_tag? => record found ...' if debug
24
24
 
25
25
  attempts_allowed = (Rails.configuration.x.login_control.attempts_allowed || 10)
26
26
  retry_after_seconds = (Rails.configuration.x.login_control.retry_after_seconds || 30)
27
- logger.info "LOGIN-CONTROL => #{rec.attempts.to_i}. attempt (config.x.attempts_allowed: #{attempts_allowed})" if debug
27
+ logger.info "LoginControlViewHelper.captcha_tag? => #{rec.attempts.to_i}. attempt (config.x.attempts_allowed: #{attempts_allowed})" if debug
28
28
 
29
29
  if rec.attempts == 1
30
30
  captcha_requested = false
31
- logger.info "LOGIN-CONTROL => captcha NOT requested: because first attempt after successful login" if debug
31
+ logger.info "LoginControlViewHelper.captcha_tag? => captcha NOT requested: because first attempt after successful login" if debug
32
32
  elsif rec.attempts.to_i <= attempts_allowed
33
33
  secs = Time.now - (rec.last_attempt || Time.now)
34
34
  if secs >= retry_after_seconds.to_f
35
35
  captcha_requested = false
36
- logger.info "LOGIN-CONTROL => captcha #{captcha_requested ? '' : 'NOT '}requested: config.x.retry_after_seconds(#{retry_after_seconds}) >= secs(#{secs})" if debug
36
+ logger.info "LoginControlViewHelper.captcha_tag? => captcha #{captcha_requested ? '' : 'NOT '}requested: config.x.retry_after_seconds(#{retry_after_seconds}) >= secs(#{secs})" if debug
37
37
  end
38
38
  end
39
39
 
40
40
  end
41
41
  rec.update!(validate_captcha: captcha_requested)
42
- logger.info "LOGIN-CONTROL => set captcha #{captcha_requested ? '' : 'NOT '}requested to record LoginControl.#{rec.id}" if debug
42
+ logger.info "LoginControlViewHelper.captcha_tag? => set captcha #{captcha_requested ? '' : 'NOT '}requested to record LoginControl.#{rec.id}" if debug
43
43
  captcha_requested
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: login-control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair