rodauth 2.32.0 → 2.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/doc/release_notes/2.33.0.txt +18 -0
- data/doc/sms_codes.rdoc +2 -0
- data/lib/rodauth/features/create_account.rb +1 -1
- data/lib/rodauth/features/email_auth.rb +6 -8
- data/lib/rodauth/features/lockout.rb +6 -8
- data/lib/rodauth/features/reset_password.rb +6 -8
- data/lib/rodauth/features/sms_codes.rb +19 -3
- data/lib/rodauth/features/verify_account.rb +6 -8
- data/lib/rodauth/features/verify_login_change.rb +6 -8
- data/lib/rodauth/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57dd78525df05b6947a84692c0f061b435dc2d07c072f689dcda121c788c59dd
|
4
|
+
data.tar.gz: 984dde3de0dd4329505eaaf04e8a49b8e5c4b8347e8dea454d6aa586ab0f5846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abb1ad9eedc3f0d23db686ac490483a86ba73c8f5a9e33bd375e5a93b98790a133b2e1da6599bfdd3759f0a56e4c890ac1cbf0f89bf7edc69e8159de7c173ed
|
7
|
+
data.tar.gz: 2d82400b1298b9a372ef8fd4aea5f9e1ba490e6572113a112f15e3dd1a3ed0655d4d934c84d18f61909bc6d0ed54c6bc2e1486f945da14cedbe35f1ea1614c10
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 2.33.0 (2023-12-21)
|
2
|
+
|
3
|
+
* Expire SMS confirm code after 24 hours by default (jeremyevans)
|
4
|
+
|
5
|
+
* Do not accidentally confirm SMS phone number on successful authentication of other second factor (Bertg) (#376, #377)
|
6
|
+
|
7
|
+
* Return error response instead of 404 response for requests to valid pages with missing tokens (janko) (#375)
|
8
|
+
|
9
|
+
* Do not override existing primary key value in the cached account when inserting a new account (janko) (#372)
|
10
|
+
|
1
11
|
=== 2.32.0 (2023-10-23)
|
2
12
|
|
3
13
|
* Remove use of Base64 in argon2 feature (jeremyevans)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= Improvements
|
2
|
+
|
3
|
+
* Rodauth no longer accidentally confirms an SMS number upon valid
|
4
|
+
authentication by an alternative second factor.
|
5
|
+
|
6
|
+
* Rodauth now automatically expires SMS confirmation codes after 24
|
7
|
+
hours by default. You can use the sms_confirm_deadline
|
8
|
+
configuration method to adjust the deadline. Previously, if an
|
9
|
+
invalid SMS number was submitted, or the SMS confirm code was never
|
10
|
+
received, it was not possible to continue SMS setup without
|
11
|
+
administrative intervention.
|
12
|
+
|
13
|
+
* Rodauth no longer overwrites existing primary key values when
|
14
|
+
inserting new accounts. This fixes cases such as setting account
|
15
|
+
primary key values to UUIDs before inserting.
|
16
|
+
|
17
|
+
* When submitting a request to a valid endpoint with a missing token,
|
18
|
+
Rodauth now returns an error response instead of a 404 response.
|
data/doc/sms_codes.rdoc
CHANGED
@@ -41,6 +41,7 @@ sms_codes_table :: The name of the table storing SMS code data.
|
|
41
41
|
sms_confirm_additional_form_tags :: HTML fragment containing additional form tags when confirming SMS setup.
|
42
42
|
sms_confirm_button :: Text to use for button on the form to confirm SMS setup.
|
43
43
|
sms_confirm_code_length :: The length of SMS confirmation codes, 12 by default, as there is no lockout.
|
44
|
+
sms_confirm_deadline :: The number of seconds before an SMS confirmation code expires (86400 seconds by default).
|
44
45
|
sms_confirm_notice_flash :: The flash notice to show when SMS authentication setup has been confirmed.
|
45
46
|
sms_confirm_page_title :: The page title to use on the form to authenticate via SMS code.
|
46
47
|
sms_confirm_redirect :: Where to redirect after SMS authentication setup has been confirmed.
|
@@ -125,6 +126,7 @@ sms_new_auth_code :: A new SMS authentication code that can be used for the acco
|
|
125
126
|
sms_new_confirm_code :: A new SMS confirmation code that can be used for the account.
|
126
127
|
sms_normalize_phone(phone) :: A normalized version of the given phone number, by default removing everything except 0-9.
|
127
128
|
sms_record_failure :: Record an SMS authentication failure for the current account.
|
129
|
+
sms_remove_expired_confirm_code :: Remove an expired SMS confirm code, allowing setup of a new sms confirm code.
|
128
130
|
sms_remove_failures :: Reset the SMS authentication failure counter for the current account, used after a successful multifactor authentication.
|
129
131
|
sms_request_response :: Return a response after a successful SMS request during SMS authentication. By default, redirects to +sms_auth_redirect+.
|
130
132
|
sms_request_view :: The HTML to use for the form to request an SMS authentication code.
|
@@ -77,14 +77,12 @@ module Rodauth
|
|
77
77
|
redirect(r.path)
|
78
78
|
end
|
79
79
|
|
80
|
-
if key = session[email_auth_session_key]
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
redirect require_login_redirect
|
87
|
-
end
|
80
|
+
if (key = session[email_auth_session_key]) && account_from_email_auth_key(key)
|
81
|
+
email_auth_view
|
82
|
+
else
|
83
|
+
remove_session_value(email_auth_session_key)
|
84
|
+
set_redirect_error_flash no_matching_email_auth_key_error_flash
|
85
|
+
redirect require_login_redirect
|
88
86
|
end
|
89
87
|
end
|
90
88
|
|
@@ -104,14 +104,12 @@ module Rodauth
|
|
104
104
|
redirect(r.path)
|
105
105
|
end
|
106
106
|
|
107
|
-
if key = session[unlock_account_session_key]
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
redirect require_login_redirect
|
114
|
-
end
|
107
|
+
if (key = session[unlock_account_session_key]) && account_from_unlock_key(key)
|
108
|
+
unlock_account_view
|
109
|
+
else
|
110
|
+
remove_session_value(unlock_account_session_key)
|
111
|
+
set_redirect_error_flash no_matching_unlock_account_key_error_flash
|
112
|
+
redirect require_login_redirect
|
115
113
|
end
|
116
114
|
end
|
117
115
|
|
@@ -109,14 +109,12 @@ module Rodauth
|
|
109
109
|
redirect(r.path)
|
110
110
|
end
|
111
111
|
|
112
|
-
if key = session[reset_password_session_key]
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
redirect require_login_redirect
|
119
|
-
end
|
112
|
+
if (key = session[reset_password_session_key]) && account_from_reset_password_key(key)
|
113
|
+
reset_password_view
|
114
|
+
else
|
115
|
+
remove_session_value(reset_password_session_key)
|
116
|
+
set_redirect_error_flash no_matching_reset_password_key_error_flash
|
117
|
+
redirect require_login_redirect
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
@@ -76,6 +76,7 @@ module Rodauth
|
|
76
76
|
auth_value_method :sms_code_param, 'sms-code'
|
77
77
|
auth_value_method :sms_codes_table, :account_sms_codes
|
78
78
|
auth_value_method :sms_confirm_code_length, 12
|
79
|
+
auth_value_method :sms_confirm_deadline, 86400
|
79
80
|
auth_value_method :sms_failure_limit, 5
|
80
81
|
auth_value_method :sms_failures_column, :num_failures
|
81
82
|
auth_value_method :sms_id_column, :id
|
@@ -112,6 +113,7 @@ module Rodauth
|
|
112
113
|
:sms_new_confirm_code,
|
113
114
|
:sms_normalize_phone,
|
114
115
|
:sms_record_failure,
|
116
|
+
:sms_remove_expired_confirm_code,
|
115
117
|
:sms_remove_failures,
|
116
118
|
:sms_send,
|
117
119
|
:sms_set_code,
|
@@ -196,6 +198,7 @@ module Rodauth
|
|
196
198
|
require_two_factor_setup
|
197
199
|
require_two_factor_authenticated
|
198
200
|
end
|
201
|
+
sms_remove_expired_confirm_code
|
199
202
|
require_sms_not_setup
|
200
203
|
|
201
204
|
if sms_needs_confirmation?
|
@@ -244,6 +247,7 @@ module Rodauth
|
|
244
247
|
require_two_factor_setup
|
245
248
|
require_two_factor_authenticated
|
246
249
|
end
|
250
|
+
sms_remove_expired_confirm_code
|
247
251
|
require_sms_not_setup
|
248
252
|
before_sms_confirm_route
|
249
253
|
|
@@ -362,16 +366,17 @@ module Rodauth
|
|
362
366
|
def sms_setup(phone_number)
|
363
367
|
# Cannot handle uniqueness violation here, as the phone number given may not match the
|
364
368
|
# one in the table.
|
365
|
-
sms_ds.insert(sms_id_column=>session_value, sms_phone_column=>phone_number)
|
369
|
+
sms_ds.insert(sms_id_column=>session_value, sms_phone_column=>phone_number, sms_failures_column => nil)
|
366
370
|
remove_instance_variable(:@sms) if instance_variable_defined?(:@sms)
|
367
371
|
end
|
368
372
|
|
369
373
|
def sms_remove_failures
|
370
|
-
|
374
|
+
return if sms_needs_confirmation?
|
375
|
+
update_hash_ds(sms, sms_ds.exclude(sms_failures_column => nil), sms_failures_column => 0, sms_code_column => nil)
|
371
376
|
end
|
372
377
|
|
373
378
|
def sms_confirm
|
374
|
-
|
379
|
+
update_hash_ds(sms, sms_ds.where(sms_failures_column => nil), sms_failures_column => 0, sms_code_column => nil)
|
375
380
|
super if defined?(super)
|
376
381
|
end
|
377
382
|
|
@@ -407,6 +412,13 @@ module Rodauth
|
|
407
412
|
update_sms(sms_code_column=>code, sms_issued_at_column=>Sequel::CURRENT_TIMESTAMP)
|
408
413
|
end
|
409
414
|
|
415
|
+
def sms_remove_expired_confirm_code
|
416
|
+
db[sms_codes_table].
|
417
|
+
where(sms_id_column=>session_value, sms_failures_column => nil).
|
418
|
+
where(Sequel[sms_issued_at_column] < Sequel.date_sub(Sequel::CURRENT_TIMESTAMP, seconds: sms_confirm_deadline)).
|
419
|
+
delete
|
420
|
+
end
|
421
|
+
|
410
422
|
def sms_record_failure
|
411
423
|
update_sms(sms_failures_column=>Sequel.expr(sms_failures_column)+1)
|
412
424
|
sms[sms_failures_column] = sms_ds.get(sms_failures_column)
|
@@ -516,5 +528,9 @@ module Rodauth
|
|
516
528
|
def sms_ds
|
517
529
|
db[sms_codes_table].where(sms_id_column=>session_value)
|
518
530
|
end
|
531
|
+
|
532
|
+
def use_date_arithmetic?
|
533
|
+
true
|
534
|
+
end
|
519
535
|
end
|
520
536
|
end
|
@@ -102,14 +102,12 @@ module Rodauth
|
|
102
102
|
redirect(r.path)
|
103
103
|
end
|
104
104
|
|
105
|
-
if key = session[verify_account_session_key]
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
redirect require_login_redirect
|
112
|
-
end
|
105
|
+
if (key = session[verify_account_session_key]) && account_from_verify_account_key(key)
|
106
|
+
verify_account_view
|
107
|
+
else
|
108
|
+
remove_session_value(verify_account_session_key)
|
109
|
+
set_redirect_error_flash no_matching_verify_account_key_error_flash
|
110
|
+
redirect require_login_redirect
|
113
111
|
end
|
114
112
|
end
|
115
113
|
|
@@ -62,14 +62,12 @@ module Rodauth
|
|
62
62
|
redirect(r.path)
|
63
63
|
end
|
64
64
|
|
65
|
-
if key = session[verify_login_change_session_key]
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
redirect require_login_redirect
|
72
|
-
end
|
65
|
+
if (key = session[verify_login_change_session_key]) && account_from_verify_login_change_key(key)
|
66
|
+
verify_login_change_view
|
67
|
+
else
|
68
|
+
remove_session_value(verify_login_change_session_key)
|
69
|
+
set_redirect_error_flash no_matching_verify_login_change_key_error_flash
|
70
|
+
redirect require_login_redirect
|
73
71
|
end
|
74
72
|
end
|
75
73
|
|
data/lib/rodauth/version.rb
CHANGED
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.
|
4
|
+
version: 2.33.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: 2023-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -350,6 +350,7 @@ extra_rdoc_files:
|
|
350
350
|
- doc/release_notes/2.30.0.txt
|
351
351
|
- doc/release_notes/2.31.0.txt
|
352
352
|
- doc/release_notes/2.32.0.txt
|
353
|
+
- doc/release_notes/2.33.0.txt
|
353
354
|
- doc/release_notes/2.4.0.txt
|
354
355
|
- doc/release_notes/2.5.0.txt
|
355
356
|
- doc/release_notes/2.6.0.txt
|
@@ -470,6 +471,7 @@ files:
|
|
470
471
|
- doc/release_notes/2.30.0.txt
|
471
472
|
- doc/release_notes/2.31.0.txt
|
472
473
|
- doc/release_notes/2.32.0.txt
|
474
|
+
- doc/release_notes/2.33.0.txt
|
473
475
|
- doc/release_notes/2.4.0.txt
|
474
476
|
- doc/release_notes/2.5.0.txt
|
475
477
|
- doc/release_notes/2.6.0.txt
|