rodauth 2.13.0 → 2.14.0

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: f01d42c90dd22a88566f17b3e77b9495dc1431f004f2f54865cff45a3874ce43
4
- data.tar.gz: b09c0a44b2b4f6ab1eb795b11a69ec7acd1d4ed5ac4abbe45d8bb4072cb61e0f
3
+ metadata.gz: 0bb25afa1cfb6fb579a10dea617ae2f9d0fdd2b302decdbf15aaf6ca88186ccb
4
+ data.tar.gz: 67c76a614ff85e298b288f81ae22fb54ea54a83c5d1584e097ba66b4dada9d1b
5
5
  SHA512:
6
- metadata.gz: 2934f2824b7c805f6400fab52aad9c4aaca2f3bbfb4584688619b0b24b9e052a3cecc4b36b6eb7379e13f2a9bf2bc64e0efac077d932e390270401966223e2ae
7
- data.tar.gz: c1dcf6d140117743baa62ba0715c99584bb80b8aa933f596424f242c2ffb6a31c7d25f0fdba65fed4b1bd93d63692502c7c63b36a1f2b793083b1972c5313304
6
+ metadata.gz: 6516c812865c540be99116e0afadfbf98de81d450dafd0aee81e6c661201e6bd62086c10db1b892e273286c53bcb61c3d84f8ed807c47e7ebd7befcd1d6cd849
7
+ data.tar.gz: 8c4efe011be6f94a0886e3dae1eb8106e3fcd295c55663f2dcea0b02794db229377450ab8738ef651e18704cc129df4f47b69e69aff08229a58f2544fab73b13
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ === 2.14.0 (2021-06-22)
2
+
3
+ * Make jwt_refresh feature allow refresh with expired access tokens even if prefix is not set correctly (jeremyevans) (#168)
4
+
5
+ * Make internal account_in_unverified_grace_period? method handle accounts missing or unverified accounts (janko, jeremyevans) (#167)
6
+
7
+ * Add remembered_session_id configuration method for getting session id from valid remember token if present (bjeanes) (#166)
8
+
1
9
  === 2.13.0 (2021-05-22)
2
10
 
3
11
  * Make jwt_refresh expired access token support work when using rodauth.check_active_sessions before calling r.rodauth (renchap) (#165)
data/README.rdoc CHANGED
@@ -68,7 +68,6 @@ Demo Site :: http://rodauth-demo.jeremyevans.net
68
68
  Source :: http://github.com/jeremyevans/rodauth
69
69
  Bugs :: http://github.com/jeremyevans/rodauth/issues
70
70
  Google Group :: https://groups.google.com/forum/#!forum/rodauth
71
- IRC :: irc://chat.freenode.net/#rodauth
72
71
 
73
72
  == Dependencies
74
73
 
@@ -0,0 +1,17 @@
1
+ = New Features
2
+
3
+ * A remembered_session_id method has been added for getting the
4
+ account id from a valid remember token, without modifying the
5
+ session to log the account in.
6
+
7
+ = Other Improvements
8
+
9
+ * The jwt_refresh feature's support for allowing refresh with
10
+ an expired access token now works even if the Rodauth
11
+ configuration uses an incorrect prefix.
12
+
13
+ * The internal account_in_unverified_grace_period? method now
14
+ returns false if an account has not been loaded and the
15
+ session has not been logged in. Previously, calling this
16
+ method in such cases would result in an exception being
17
+ raised.
data/doc/remember.rdoc CHANGED
@@ -69,6 +69,7 @@ generate_remember_key_value :: A random string to use as the remember key.
69
69
  get_remember_key :: Retrieve the remember key from the database.
70
70
  load_memory :: If the remember key cookie is included in the request, and the user is not currently logged in, check the remember keys table and autologin the user if the remember key cookie matches the current remember key for the account. This method needs to be called manually inside the Roda route block to autologin users.
71
71
  logged_in_via_remember_key? :: Whether the current session was logged in via a remember key.
72
+ remembered_session_id :: The session_id which is validly remembered, if any.
72
73
  remember_key_value :: The current value of the remember key/token.
73
74
  remember_login :: Set the cookie containing the remember token, so that future sessions will be autologged in.
74
75
  remember_view :: The HTML to use for the change remember settings form.
@@ -32,8 +32,6 @@ module Rodauth
32
32
  )
33
33
 
34
34
  route do |r|
35
- # For backward compatibility, unused in core Rodauth
36
- # RODAUTH3: Remove
37
35
  @jwt_refresh_route = true
38
36
  before_jwt_refresh_route
39
37
 
@@ -137,7 +135,7 @@ module Rodauth
137
135
  end
138
136
 
139
137
  def _jwt_decode_opts
140
- if allow_refresh_with_expired_jwt_access_token? && request.path == jwt_refresh_path
138
+ if allow_refresh_with_expired_jwt_access_token? && (@jwt_refresh_route || request.path == jwt_refresh_path)
141
139
  Hash[super].merge!(:verify_expiration=>false)
142
140
  else
143
141
  super
@@ -39,6 +39,7 @@ module Rodauth
39
39
  :generate_remember_key_value,
40
40
  :get_remember_key,
41
41
  :load_memory,
42
+ :remembered_session_id,
42
43
  :logged_in_via_remember_key?,
43
44
  :remember_key_value,
44
45
  :remember_login,
@@ -81,29 +82,35 @@ module Rodauth
81
82
  end
82
83
  end
83
84
 
84
- def load_memory
85
- return if session[session_key]
85
+ def remembered_session_id
86
86
  return unless cookie = request.cookies[remember_cookie_key]
87
87
  id, key = cookie.split('_', 2)
88
88
  return unless id && key
89
89
 
90
90
  actual, deadline = active_remember_key_ds(id).get([remember_key_column, remember_deadline_column])
91
- unless actual
92
- forget_login
93
- return
94
- end
91
+ return unless actual
95
92
 
96
93
  if hmac_secret
97
94
  unless valid = timing_safe_eql?(key, compute_hmac(actual))
98
95
  unless raw_remember_token_deadline && raw_remember_token_deadline > convert_timestamp(deadline)
99
- forget_login
100
96
  return
101
97
  end
102
98
  end
103
99
  end
104
100
 
105
101
  unless valid || timing_safe_eql?(key, actual)
106
- forget_login
102
+ return
103
+ end
104
+
105
+ id
106
+ end
107
+
108
+ def load_memory
109
+ return if session[session_key]
110
+
111
+ unless id = remembered_session_id
112
+ # Only set expired cookie if there is already a cookie set.
113
+ forget_login if request.cookies[remember_cookie_key]
107
114
  return
108
115
  end
109
116
 
@@ -72,7 +72,7 @@ module Rodauth
72
72
  end
73
73
 
74
74
  def account_in_unverified_grace_period?
75
- account || account_from_session
75
+ return false unless account || (session_value && account_from_session)
76
76
  account[account_status_column] == account_unverified_status_value &&
77
77
  verify_account_grace_period &&
78
78
  !verify_account_ds.where(Sequel.date_add(verification_requested_at_column, :seconds=>verify_account_grace_period) > Sequel::CURRENT_TIMESTAMP).empty?
@@ -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 = 13
9
+ MINOR = 14
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -325,6 +325,7 @@ extra_rdoc_files:
325
325
  - doc/release_notes/2.11.0.txt
326
326
  - doc/release_notes/2.12.0.txt
327
327
  - doc/release_notes/2.13.0.txt
328
+ - doc/release_notes/2.14.0.txt
328
329
  - doc/release_notes/2.2.0.txt
329
330
  - doc/release_notes/2.3.0.txt
330
331
  - doc/release_notes/2.4.0.txt
@@ -421,6 +422,7 @@ files:
421
422
  - doc/release_notes/2.11.0.txt
422
423
  - doc/release_notes/2.12.0.txt
423
424
  - doc/release_notes/2.13.0.txt
425
+ - doc/release_notes/2.14.0.txt
424
426
  - doc/release_notes/2.2.0.txt
425
427
  - doc/release_notes/2.3.0.txt
426
428
  - doc/release_notes/2.4.0.txt