rodauth 2.39.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/otp_unlock.rb +7 -0
- data/lib/rodauth/features/remember.rb +6 -0
- data/lib/rodauth/features/reset_password.rb +12 -9
- 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
- data/templates/otp-unlock-not-available.str +0 -1
- metadata +2 -2
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
|
@@ -52,6 +52,7 @@ module Rodauth
|
|
52
52
|
:otp_unlock_auth_success,
|
53
53
|
:otp_unlock_available?,
|
54
54
|
:otp_unlock_deadline_passed?,
|
55
|
+
:otp_unlock_not_available_set_refresh_header,
|
55
56
|
:otp_unlock_refresh_tag,
|
56
57
|
)
|
57
58
|
|
@@ -72,6 +73,7 @@ module Rodauth
|
|
72
73
|
if otp_unlock_available?
|
73
74
|
otp_unlock_view
|
74
75
|
else
|
76
|
+
otp_unlock_not_available_set_refresh_header
|
75
77
|
otp_unlock_not_available_view
|
76
78
|
end
|
77
79
|
end
|
@@ -201,6 +203,7 @@ module Rodauth
|
|
201
203
|
end
|
202
204
|
|
203
205
|
def otp_unlock_refresh_tag
|
206
|
+
# RODAUTH3: Remove
|
204
207
|
"<meta http-equiv=\"refresh\" content=\"#{(otp_unlock_next_auth_attempt_after - Time.now).to_i + 1}\">"
|
205
208
|
end
|
206
209
|
|
@@ -224,6 +227,10 @@ module Rodauth
|
|
224
227
|
otp_unlock_data ? otp_unlock_data[otp_unlock_num_successes_column] : 0
|
225
228
|
end
|
226
229
|
|
230
|
+
def otp_unlock_not_available_set_refresh_header
|
231
|
+
response.headers["refresh"] = ((otp_unlock_next_auth_attempt_after - Time.now).to_i + 1).to_s
|
232
|
+
end
|
233
|
+
|
227
234
|
private
|
228
235
|
|
229
236
|
def show_otp_auth_link?
|
@@ -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)
|
@@ -50,6 +50,7 @@ module Rodauth
|
|
50
50
|
:reset_password_email_link,
|
51
51
|
:reset_password_key_insert_hash,
|
52
52
|
:reset_password_key_value,
|
53
|
+
:reset_password_request_for_unverified_account,
|
53
54
|
:set_reset_password_email_last_sent
|
54
55
|
)
|
55
56
|
auth_private_methods(
|
@@ -73,9 +74,7 @@ module Rodauth
|
|
73
74
|
throw_error_reason(:no_matching_login, no_matching_login_error_status, login_param, no_matching_login_message)
|
74
75
|
end
|
75
76
|
|
76
|
-
unless open_account?
|
77
|
-
throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message)
|
78
|
-
end
|
77
|
+
reset_password_request_for_unverified_account unless open_account?
|
79
78
|
|
80
79
|
if reset_password_email_recently_sent?
|
81
80
|
set_redirect_error_flash reset_password_email_recently_sent_error_flash
|
@@ -144,7 +143,7 @@ module Rodauth
|
|
144
143
|
transaction do
|
145
144
|
before_reset_password
|
146
145
|
set_password(password)
|
147
|
-
|
146
|
+
clear_tokens(:reset_password)
|
148
147
|
after_reset_password
|
149
148
|
end
|
150
149
|
|
@@ -174,6 +173,10 @@ module Rodauth
|
|
174
173
|
end
|
175
174
|
end
|
176
175
|
|
176
|
+
def reset_password_request_for_unverified_account
|
177
|
+
throw_error_reason(:unverified_account, unopen_account_error_status, login_param, unverified_account_message)
|
178
|
+
end
|
179
|
+
|
177
180
|
def remove_reset_password_key
|
178
181
|
password_reset_ds.delete
|
179
182
|
end
|
@@ -208,6 +211,11 @@ module Rodauth
|
|
208
211
|
(email_last_sent = get_reset_password_email_last_sent) && (Time.now - email_last_sent < reset_password_skip_resend_email_within)
|
209
212
|
end
|
210
213
|
|
214
|
+
def clear_tokens(reason)
|
215
|
+
super
|
216
|
+
remove_reset_password_key
|
217
|
+
end
|
218
|
+
|
211
219
|
private
|
212
220
|
|
213
221
|
def _login_form_footer_links
|
@@ -223,11 +231,6 @@ module Rodauth
|
|
223
231
|
super
|
224
232
|
end
|
225
233
|
|
226
|
-
def after_close_account
|
227
|
-
remove_reset_password_key
|
228
|
-
super if defined?(super)
|
229
|
-
end
|
230
|
-
|
231
234
|
def generate_reset_password_key_value
|
232
235
|
@reset_password_key_value = random_key
|
233
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
@@ -2,4 +2,3 @@
|
|
2
2
|
<p>#{rodauth.otp_unlock_required_consecutive_successes_label}: #{rodauth.otp_unlock_auths_required}</p>
|
3
3
|
<p>#{rodauth.otp_unlock_next_auth_attempt_label}: #{rodauth.otp_unlock_next_auth_attempt_after.strftime(rodauth.strftime_format)}</p>
|
4
4
|
<p>#{rodauth.otp_unlock_next_auth_attempt_refresh_label}</p>
|
5
|
-
#{rodauth.otp_unlock_refresh_tag}
|
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.
|
4
|
+
version: 2.41.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
402
402
|
- !ruby/object:Gem::Version
|
403
403
|
version: '0'
|
404
404
|
requirements: []
|
405
|
-
rubygems_version: 3.6.
|
405
|
+
rubygems_version: 3.6.9
|
406
406
|
specification_version: 4
|
407
407
|
summary: Authentication and Account Management Framework for Rack Applications
|
408
408
|
test_files: []
|