rodauth 2.40.0 → 2.41.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 +4 -4
- data/lib/rodauth/features/active_sessions.rb +5 -0
- data/lib/rodauth/features/base.rb +4 -0
- data/lib/rodauth/features/change_login.rb +3 -1
- data/lib/rodauth/features/close_account.rb +2 -1
- data/lib/rodauth/features/email_auth.rb +5 -5
- data/lib/rodauth/features/jwt_refresh.rb +5 -0
- data/lib/rodauth/features/lockout.rb +6 -0
- data/lib/rodauth/features/remember.rb +6 -0
- data/lib/rodauth/features/reset_password.rb +6 -6
- data/lib/rodauth/features/single_session.rb +7 -2
- data/lib/rodauth/features/verify_account.rb +6 -1
- data/lib/rodauth/features/verify_login_change.rb +4 -4
- data/lib/rodauth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 744dace1fbf5e3ddd602eb8d143b62160960f5dabce29ee512096fa958cf6454
|
4
|
+
data.tar.gz: a2405f22aacc403a5c5a1a868e758dff10bfe961f9c8bcac3c4138b6acad389b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeaf6a82e9dc58986ee0318706fd9af2d62e031f039f77cfbb1478a92db65cddb88ee25bb538d249a3b3b23bd2f64ec659de986107f404e74e557de2c077c209
|
7
|
+
data.tar.gz: ebe5f8713408b3e1d0e26a82b824371e7ebf4980a8d4447a6e0f4dd971777d1718a9b73ba53ee2d1e0ea9713d618d6b09e5587f21723ef32cb7908dfea5833c2
|
@@ -93,6 +93,7 @@ module Rodauth
|
|
93
93
|
:autocomplete_for_field?,
|
94
94
|
:check_csrf,
|
95
95
|
:clear_session,
|
96
|
+
:clear_tokens,
|
96
97
|
:csrf_tag,
|
97
98
|
:function_name,
|
98
99
|
:hook_action,
|
@@ -330,6 +331,9 @@ module Rodauth
|
|
330
331
|
end
|
331
332
|
end
|
332
333
|
|
334
|
+
def clear_tokens(reason)
|
335
|
+
end
|
336
|
+
|
333
337
|
def login_required
|
334
338
|
set_redirect_error_status(login_required_error_status)
|
335
339
|
set_error_reason :login_required
|
@@ -86,7 +86,9 @@ module Rodauth
|
|
86
86
|
if raised
|
87
87
|
set_login_requirement_error_message(:already_an_account_with_this_login, already_an_account_with_this_login_message)
|
88
88
|
end
|
89
|
-
updated && !raised
|
89
|
+
change_made = updated && !raised
|
90
|
+
clear_tokens(:change_login) if change_made
|
91
|
+
change_made
|
90
92
|
end
|
91
93
|
end
|
92
94
|
end
|
@@ -167,6 +167,11 @@ module Rodauth
|
|
167
167
|
(email_last_sent = get_email_auth_email_last_sent) && (Time.now - email_last_sent < email_auth_skip_resend_email_within)
|
168
168
|
end
|
169
169
|
|
170
|
+
def clear_tokens(reason)
|
171
|
+
super
|
172
|
+
remove_email_auth_key
|
173
|
+
end
|
174
|
+
|
170
175
|
private
|
171
176
|
|
172
177
|
def _multi_phase_login_forms
|
@@ -210,11 +215,6 @@ module Rodauth
|
|
210
215
|
super
|
211
216
|
end
|
212
217
|
|
213
|
-
def after_close_account
|
214
|
-
remove_email_auth_key
|
215
|
-
super if defined?(super)
|
216
|
-
end
|
217
|
-
|
218
218
|
def generate_email_auth_key_value
|
219
219
|
@email_auth_key_value = random_key
|
220
220
|
end
|
@@ -126,6 +126,7 @@ module Rodauth
|
|
126
126
|
transaction do
|
127
127
|
before_unlock_account
|
128
128
|
unlock_account
|
129
|
+
clear_tokens(:unlock_account)
|
129
130
|
after_unlock_account
|
130
131
|
if unlock_account_autologin?
|
131
132
|
autologin_session('unlock_account')
|
@@ -241,6 +242,11 @@ module Rodauth
|
|
241
242
|
(email_last_sent = get_unlock_account_email_last_sent) && (Time.now - email_last_sent < unlock_account_skip_resend_email_within)
|
242
243
|
end
|
243
244
|
|
245
|
+
def clear_tokens(reason)
|
246
|
+
super
|
247
|
+
account_lockouts_ds.update(account_lockouts_key_column => generate_unlock_account_key)
|
248
|
+
end
|
249
|
+
|
244
250
|
private
|
245
251
|
|
246
252
|
attr_reader :unlock_account_key_value
|
@@ -175,6 +175,12 @@ module Rodauth
|
|
175
175
|
authenticated_by.include?('remember')
|
176
176
|
end
|
177
177
|
|
178
|
+
def clear_tokens(reason)
|
179
|
+
super
|
180
|
+
remove_remember_key
|
181
|
+
remember_login if logged_in? && logged_in_via_remember_key?
|
182
|
+
end
|
183
|
+
|
178
184
|
private
|
179
185
|
|
180
186
|
def _set_remember_cookie(account_id, remember_key_value, deadline)
|
@@ -143,7 +143,7 @@ module Rodauth
|
|
143
143
|
transaction do
|
144
144
|
before_reset_password
|
145
145
|
set_password(password)
|
146
|
-
|
146
|
+
clear_tokens(:reset_password)
|
147
147
|
after_reset_password
|
148
148
|
end
|
149
149
|
|
@@ -211,6 +211,11 @@ module Rodauth
|
|
211
211
|
(email_last_sent = get_reset_password_email_last_sent) && (Time.now - email_last_sent < reset_password_skip_resend_email_within)
|
212
212
|
end
|
213
213
|
|
214
|
+
def clear_tokens(reason)
|
215
|
+
super
|
216
|
+
remove_reset_password_key
|
217
|
+
end
|
218
|
+
|
214
219
|
private
|
215
220
|
|
216
221
|
def _login_form_footer_links
|
@@ -226,11 +231,6 @@ module Rodauth
|
|
226
231
|
super
|
227
232
|
end
|
228
233
|
|
229
|
-
def after_close_account
|
230
|
-
remove_reset_password_key
|
231
|
-
super if defined?(super)
|
232
|
-
end
|
233
|
-
|
234
234
|
def generate_reset_password_key_value
|
235
235
|
@reset_password_key_value = random_key
|
236
236
|
end
|
@@ -79,6 +79,11 @@ module Rodauth
|
|
79
79
|
update_single_session_key
|
80
80
|
end
|
81
81
|
|
82
|
+
def clear_tokens(reason)
|
83
|
+
super
|
84
|
+
single_session_ds(account_id).delete unless logged_in?
|
85
|
+
end
|
86
|
+
|
82
87
|
private
|
83
88
|
|
84
89
|
def after_close_account
|
@@ -96,9 +101,9 @@ module Rodauth
|
|
96
101
|
set_session_value(single_session_session_key, data)
|
97
102
|
end
|
98
103
|
|
99
|
-
def single_session_ds
|
104
|
+
def single_session_ds(id=session_value)
|
100
105
|
db[single_session_table].
|
101
|
-
where(single_session_id_column=>
|
106
|
+
where(single_session_id_column=>id)
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
@@ -139,7 +139,7 @@ module Rodauth
|
|
139
139
|
if verify_account_set_password?
|
140
140
|
set_password(password)
|
141
141
|
end
|
142
|
-
|
142
|
+
clear_tokens(:verify_account)
|
143
143
|
after_verify_account
|
144
144
|
end
|
145
145
|
|
@@ -244,6 +244,11 @@ module Rodauth
|
|
244
244
|
account && (email_last_sent = get_verify_account_email_last_sent) && (Time.now - email_last_sent < verify_account_skip_resend_email_within)
|
245
245
|
end
|
246
246
|
|
247
|
+
def clear_tokens(reason)
|
248
|
+
super
|
249
|
+
remove_verify_account_key
|
250
|
+
end
|
251
|
+
|
247
252
|
private
|
248
253
|
|
249
254
|
def _login_form_footer_links
|
@@ -144,13 +144,13 @@ module Rodauth
|
|
144
144
|
attr_reader :verify_login_change_key_value
|
145
145
|
attr_reader :verify_login_change_new_login
|
146
146
|
|
147
|
-
|
148
|
-
|
149
|
-
def after_close_account
|
147
|
+
def clear_tokens(reason)
|
148
|
+
super
|
150
149
|
remove_verify_login_change_key
|
151
|
-
super if defined?(super)
|
152
150
|
end
|
153
151
|
|
152
|
+
private
|
153
|
+
|
154
154
|
def update_login(login)
|
155
155
|
if _account_from_login(login)
|
156
156
|
set_login_requirement_error_message(:already_an_account_with_this_login, already_an_account_with_this_login_message)
|
data/lib/rodauth/version.rb
CHANGED