login-control 0.0.16 → 0.0.17

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: f8a0041b25da378a40ee536b9689846301d6b13eb062f2001fae995a78540094
4
- data.tar.gz: b40069097f5b5d8e3bf2025ae63a1b3e88c4adb8a1e07c2771aa389aba4a8941
3
+ metadata.gz: 4c994c7999c34ab1e07335a16f36d527834a8591f6848f6009aa894ed5a12076
4
+ data.tar.gz: 2822fe19d6389196d1fb487924087d981635b828a176601543f44a606e99292c
5
5
  SHA512:
6
- metadata.gz: 130e57bb3dc647f3785c3e1dc295e1ecc57f50359579cc516ca2b1b1ce80adc152200071bd0394e20508910b91e575769b37a076e56cec23f9c6860867a66c76
7
- data.tar.gz: 7fa194e79c11dc09897c99412d26d3b9c16f902349e931d1f8f27ce2404262f060ed115e0cc9a4f0ab2f44b7db3d6a1afaf766f888a8c24287b973f9812828bb
6
+ metadata.gz: c8ffc4147cdf9c9ba480fc1e243b37076ef4cc849076ecfe16077104123801452010003817c1d59002b11eadf3be64d42069f680a4d978655735df75f884b02a
7
+ data.tar.gz: 70e576d62335077e76f27f9661dfbc7f3d32dd139220e5390abc7d699c8b56c8877c29c5926d374d89e5083508342e4654b50da10c3dacddd3ec779008233427
data/README.md CHANGED
@@ -16,7 +16,7 @@ On localhost captcha is never required.
16
16
 
17
17
  ## Installation
18
18
 
19
- `gem 'request-control'`
19
+ `gem 'login-control'`
20
20
 
21
21
  run
22
22
  ```
@@ -50,10 +50,10 @@ class SessionsController < Devise::SessionsController
50
50
  include LoginControlModule
51
51
 
52
52
  def create
53
- notice_request_attempt
53
+ notice_login_attempt
54
54
  if (captcha_validation? ? verify_hcaptcha(secret_key: ...) : true) && credentials-matched
55
55
  super
56
- notice_successful_request
56
+ notice_successful_login
57
57
  else
58
58
  redirect_to login_path, alert: 'captcha failed'
59
59
  end
@@ -4,39 +4,39 @@ module LoginControlModule
4
4
  def captcha_validation?(scope: :global, login_name: nil)
5
5
  rec = rc_record(scope, login_name)
6
6
  if request.host == 'localhost'
7
- logger.info "LoginControlModule => get captcha NOT requested because localhost" if debug_request_control
7
+ logger.info "LoginControlModule.captcha_validation? => captcha NOT requested because localhost" if debug_request_control
8
8
  false
9
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
10
+ logger.info "LoginControlModule.captcha_validation? => captcha NOT requested because Rails.env #{Rails.env}" if debug_request_control
11
11
  false
12
12
  elsif rec
13
- logger.info "LoginControlModule => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
13
+ logger.info "LoginControlModule.captcha_validation? => get captcha #{rec&.validate_captcha ? '' : 'NOT '}requested from record LoginControl.#{rec&.id}" if debug_request_control
14
14
  rec.validate_captcha
15
15
  else
16
- logger.info "LoginControlModule => get captcha requested (all other conditions failed)" if debug_request_control
16
+ logger.info "LoginControlModule.captcha_validation? => get captcha requested (all other conditions failed)" if debug_request_control
17
17
  true
18
18
  end
19
19
  end
20
20
 
21
21
  # stores cookie, count-up sign_in_success, set attempts count to 1
22
22
 
23
- def notice_successful_request(scope: :global, login_name: nil)
23
+ def notice_successful_login(scope: :global, login_name: nil)
24
24
  rec = find_or_build_rc_record(scope, login_name)
25
25
  rec.sign_in_success = rec.sign_in_success.to_i + 1
26
26
  rec.last_attempt = DateTime.now
27
27
  rec.attempts = 1
28
28
  rec.save!
29
- logger.info "LoginControlModule.notice_successful_request => #{rec.sign_in_success}. successful request noticed" if debug_request_control
29
+ logger.info "LoginControlModule.notice_successful_login => #{rec.sign_in_success}. successful request noticed" if debug_request_control
30
30
  end
31
31
 
32
32
  # stores cookie, counts up attempts
33
33
 
34
- def notice_request_attempt(scope: :global, login_name: nil)
34
+ def notice_login_attempt(scope: :global, login_name: nil)
35
35
  rec = find_or_build_rc_record(scope, login_name)
36
36
  rec.attempts = rec.attempts.to_i + 1
37
37
  rec.last_attempt = DateTime.now
38
38
  rec.save!
39
- logger.info "LoginControlModule.notice_request_attempt => #{rec.attempts}. request attempt noticed" if debug_request_control
39
+ logger.info "LoginControlModule.notice_login_attempt => #{rec.attempts}. request attempt noticed" if debug_request_control
40
40
  end
41
41
 
42
42
  private
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.16
4
+ version: 0.0.17
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-27 00:00:00.000000000 Z
11
+ date: 2023-01-28 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.