rodauth 2.49.0 → 2.50.0

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: 24077da1fc384a74f6e692220eeac283243ce13c0d219befdbd43c4a3498ab63
4
- data.tar.gz: b05d593e3e12ebcf503c8de530613dea813cfa90984c058d1910bab7cb010674
3
+ metadata.gz: c7c3fd220443be9dd5e5b2d565d2bb00cc295ca3a715b33c785265e1f6d68965
4
+ data.tar.gz: e73cdd307e16ab113fdd6c7082a80007748d0ebdbfda7bbcbafae428b69e1dc0
5
5
  SHA512:
6
- metadata.gz: 8e6d8819e37fd3d417641dc1745360c9ff52df0ee90399ad844ad7d3c23990d1c74f9db31d698e17861881e8776f5fb3fb4aae07ab4d9e2762e257ffd334d51f
7
- data.tar.gz: 902ece75d3590486435729195e741834c4613d379f47ca29b93ba68281810273b36ae94374c9c9b317ca49464e60c1be15d344b88c94bada8fd1f8ea5668dde1
6
+ metadata.gz: ba857c68a2b1c54de8195798340cbe4a6f992b9f357c68a977aa78e1469c5d8b2b8eee3cdd3905109cb1c5ff127cb391b016f48cd55c56d32a44e8497f9f6abe
7
+ data.tar.gz: 75dc0b8cd4ca3c6142c74a30c190eb5ed6ad54580d1a89a4357abc659779cb80d9450276ffb4435ca0eeed7747187cbbe595d65d73292a0975fee24bc581d7b7
@@ -31,8 +31,10 @@ module Rodauth
31
31
  def hook_action(hook_type, action)
32
32
  super
33
33
 
34
- # In after_logout, session is already cleared, so use before_logout in that case
35
- if (hook_type == :after || action == :logout) && (id = account_id_or_session_value)
34
+ # Audit after successful actions. Logout is audited on before_logout
35
+ # because logout/clear_session runs before after_logout and does not
36
+ # clear @account, which would otherwise duplicate the logout audit.
37
+ if hook_type == (action == :logout ? :before : :after) && (id = account_id_or_session_value)
36
38
  add_audit_log(id, action)
37
39
  end
38
40
  end
@@ -100,7 +100,7 @@ module Rodauth
100
100
  :otp_valid_code_for_old_secret
101
101
  )
102
102
 
103
- uses_instance_variables(:@otp, :@otp_key, :@otp_user_key, :@otp_tmp_key)
103
+ uses_instance_variables(:@otp, :@otp_key, :@otp_user_key, :@otp_tmp_key, :@otp_verify_time)
104
104
 
105
105
  internal_request_method :otp_setup_params
106
106
  internal_request_method :otp_setup
@@ -275,7 +275,7 @@ module Rodauth
275
275
  otp.verify_with_drift(ot_pass, drift)
276
276
  # simplecov:enable
277
277
  else
278
- otp.verify(ot_pass, :drift_behind=>drift, :drift_ahead=>drift, :after=>otp_last_use)
278
+ @otp_verify_time = otp.verify(ot_pass, :drift_behind=>drift, :drift_ahead=>drift, :after=>otp_last_use)
279
279
  end
280
280
  # simplecov:disable
281
281
  elsif otp.respond_to?(:verify_with_drift)
@@ -297,9 +297,10 @@ module Rodauth
297
297
  end
298
298
 
299
299
  def otp_update_last_use
300
+ verify_time = @otp_verify_time.is_a?(Integer) ? Time.at(@otp_verify_time) : Sequel::CURRENT_TIMESTAMP # simplecov:disable
300
301
  otp_key_ds.
301
- where(Sequel.date_add(otp_keys_last_use_column, :seconds=>_otp_interval) < Sequel::CURRENT_TIMESTAMP).
302
- update(otp_keys_last_use_column=>Sequel::CURRENT_TIMESTAMP) == 1
302
+ where(Sequel.date_add(otp_keys_last_use_column, :seconds=>_otp_interval) < verify_time).
303
+ update(otp_keys_last_use_column=>verify_time) == 1
303
304
  end
304
305
 
305
306
  def otp_last_use
@@ -6,7 +6,7 @@ module Rodauth
6
6
  MAJOR = 2
7
7
 
8
8
  # The minor version of Rodauth, updated for new feature releases of Rodauth.
9
- MINOR = 49
9
+ MINOR = 50
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.49.0
4
+ version: 2.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans