rodauth 2.36.0 → 2.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rodauth/features/base.rb +15 -1
- data/lib/rodauth/features/change_login.rb +2 -2
- data/lib/rodauth/features/create_account.rb +2 -2
- data/lib/rodauth/features/email_auth.rb +1 -1
- data/lib/rodauth/features/internal_request.rb +4 -4
- data/lib/rodauth/features/json.rb +5 -0
- data/lib/rodauth/features/jwt.rb +5 -9
- data/lib/rodauth/features/lockout.rb +1 -1
- data/lib/rodauth/features/login.rb +1 -1
- data/lib/rodauth/features/login_password_requirements_base.rb +13 -0
- data/lib/rodauth/features/reset_password.rb +1 -1
- data/lib/rodauth/features/two_factor_base.rb +6 -13
- data/lib/rodauth/features/verify_account.rb +2 -2
- data/lib/rodauth/features/webauthn_autofill.rb +2 -1
- data/lib/rodauth/features/webauthn_login.rb +1 -1
- data/lib/rodauth/version.rb +1 -1
- data/lib/rodauth.rb +6 -2
- metadata +3 -258
- data/CHANGELOG +0 -521
- data/README.rdoc +0 -1555
- data/doc/account_expiration.rdoc +0 -41
- data/doc/active_sessions.rdoc +0 -56
- data/doc/argon2.rdoc +0 -54
- data/doc/audit_logging.rdoc +0 -44
- data/doc/base.rdoc +0 -123
- data/doc/change_login.rdoc +0 -25
- data/doc/change_password.rdoc +0 -26
- data/doc/change_password_notify.rdoc +0 -14
- data/doc/close_account.rdoc +0 -26
- data/doc/confirm_password.rdoc +0 -32
- data/doc/create_account.rdoc +0 -27
- data/doc/disallow_common_passwords.rdoc +0 -17
- data/doc/disallow_password_reuse.rdoc +0 -30
- data/doc/email_auth.rdoc +0 -55
- data/doc/email_base.rdoc +0 -18
- data/doc/error_reasons.rdoc +0 -77
- data/doc/guides/admin_activation.rdoc +0 -46
- data/doc/guides/already_authenticated.rdoc +0 -10
- data/doc/guides/alternative_login.rdoc +0 -46
- data/doc/guides/change_table_and_column_names.rdoc +0 -19
- data/doc/guides/create_account_programmatically.rdoc +0 -38
- data/doc/guides/delay_password.rdoc +0 -25
- data/doc/guides/email_only.rdoc +0 -16
- data/doc/guides/i18n.rdoc +0 -29
- data/doc/guides/internals.rdoc +0 -233
- data/doc/guides/links.rdoc +0 -12
- data/doc/guides/login_return.rdoc +0 -37
- data/doc/guides/migrate_password_hash_algorithm.rdoc +0 -15
- data/doc/guides/password_column.rdoc +0 -25
- data/doc/guides/password_confirmation.rdoc +0 -37
- data/doc/guides/password_requirements.rdoc +0 -43
- data/doc/guides/paths.rdoc +0 -51
- data/doc/guides/query_params.rdoc +0 -9
- data/doc/guides/redirects.rdoc +0 -17
- data/doc/guides/registration_field.rdoc +0 -68
- data/doc/guides/render_confirmation.rdoc +0 -17
- data/doc/guides/require_mfa.rdoc +0 -30
- data/doc/guides/reset_password_autologin.rdoc +0 -21
- data/doc/guides/share_configuration.rdoc +0 -34
- data/doc/guides/status_column.rdoc +0 -28
- data/doc/guides/totp_or_recovery.rdoc +0 -16
- data/doc/http_basic_auth.rdoc +0 -18
- data/doc/internal_request.rdoc +0 -539
- data/doc/json.rdoc +0 -56
- data/doc/jwt.rdoc +0 -52
- data/doc/jwt_cors.rdoc +0 -22
- data/doc/jwt_refresh.rdoc +0 -58
- data/doc/lockout.rdoc +0 -73
- data/doc/login.rdoc +0 -39
- data/doc/login_password_requirements_base.rdoc +0 -44
- data/doc/logout.rdoc +0 -22
- data/doc/otp.rdoc +0 -93
- data/doc/otp_lockout_email.rdoc +0 -30
- data/doc/otp_modify_email.rdoc +0 -19
- data/doc/otp_unlock.rdoc +0 -58
- data/doc/password_complexity.rdoc +0 -34
- data/doc/password_expiration.rdoc +0 -38
- data/doc/password_grace_period.rdoc +0 -24
- data/doc/password_pepper.rdoc +0 -52
- data/doc/path_class_methods.rdoc +0 -10
- data/doc/recovery_codes.rdoc +0 -61
- data/doc/release_notes/1.0.0.txt +0 -443
- data/doc/release_notes/1.1.0.txt +0 -8
- data/doc/release_notes/1.10.0.txt +0 -80
- data/doc/release_notes/1.11.0.txt +0 -32
- data/doc/release_notes/1.12.0.txt +0 -61
- data/doc/release_notes/1.13.0.txt +0 -34
- data/doc/release_notes/1.14.0.txt +0 -19
- data/doc/release_notes/1.15.0.txt +0 -21
- data/doc/release_notes/1.16.0.txt +0 -31
- data/doc/release_notes/1.17.0.txt +0 -23
- data/doc/release_notes/1.18.0.txt +0 -26
- data/doc/release_notes/1.19.0.txt +0 -116
- data/doc/release_notes/1.2.0.txt +0 -18
- data/doc/release_notes/1.20.0.txt +0 -175
- data/doc/release_notes/1.21.0.txt +0 -12
- data/doc/release_notes/1.22.0.txt +0 -11
- data/doc/release_notes/1.23.0.txt +0 -32
- data/doc/release_notes/1.3.0.txt +0 -21
- data/doc/release_notes/1.4.0.txt +0 -11
- data/doc/release_notes/1.5.0.txt +0 -74
- data/doc/release_notes/1.6.0.txt +0 -37
- data/doc/release_notes/1.7.0.txt +0 -6
- data/doc/release_notes/1.8.0.txt +0 -14
- data/doc/release_notes/1.9.0.txt +0 -15
- data/doc/release_notes/2.0.0.txt +0 -361
- data/doc/release_notes/2.1.0.txt +0 -31
- data/doc/release_notes/2.10.0.txt +0 -47
- data/doc/release_notes/2.11.0.txt +0 -31
- data/doc/release_notes/2.12.0.txt +0 -17
- data/doc/release_notes/2.13.0.txt +0 -19
- data/doc/release_notes/2.14.0.txt +0 -17
- data/doc/release_notes/2.15.0.txt +0 -48
- data/doc/release_notes/2.16.0.txt +0 -20
- data/doc/release_notes/2.17.0.txt +0 -10
- data/doc/release_notes/2.18.0.txt +0 -27
- data/doc/release_notes/2.19.0.txt +0 -61
- data/doc/release_notes/2.2.0.txt +0 -39
- data/doc/release_notes/2.20.0.txt +0 -10
- data/doc/release_notes/2.21.0.txt +0 -28
- data/doc/release_notes/2.22.0.txt +0 -43
- data/doc/release_notes/2.23.0.txt +0 -15
- data/doc/release_notes/2.24.0.txt +0 -15
- data/doc/release_notes/2.25.0.txt +0 -8
- data/doc/release_notes/2.26.0.txt +0 -45
- data/doc/release_notes/2.27.0.txt +0 -35
- data/doc/release_notes/2.28.0.txt +0 -16
- data/doc/release_notes/2.29.0.txt +0 -27
- data/doc/release_notes/2.3.0.txt +0 -37
- data/doc/release_notes/2.30.0.txt +0 -15
- data/doc/release_notes/2.31.0.txt +0 -47
- data/doc/release_notes/2.32.0.txt +0 -65
- data/doc/release_notes/2.33.0.txt +0 -18
- data/doc/release_notes/2.34.0.txt +0 -36
- data/doc/release_notes/2.35.0.txt +0 -22
- data/doc/release_notes/2.36.0.txt +0 -35
- data/doc/release_notes/2.4.0.txt +0 -22
- data/doc/release_notes/2.5.0.txt +0 -20
- data/doc/release_notes/2.6.0.txt +0 -37
- data/doc/release_notes/2.7.0.txt +0 -33
- data/doc/release_notes/2.8.0.txt +0 -20
- data/doc/release_notes/2.9.0.txt +0 -21
- data/doc/remember.rdoc +0 -79
- data/doc/reset_password.rdoc +0 -66
- data/doc/reset_password_notify.rdoc +0 -17
- data/doc/session_expiration.rdoc +0 -28
- data/doc/single_session.rdoc +0 -37
- data/doc/sms_codes.rdoc +0 -138
- data/doc/two_factor_base.rdoc +0 -70
- data/doc/update_password_hash.rdoc +0 -7
- data/doc/verify_account.rdoc +0 -67
- data/doc/verify_account_grace_period.rdoc +0 -19
- data/doc/verify_login_change.rdoc +0 -59
- data/doc/webauthn.rdoc +0 -118
- data/doc/webauthn_autofill.rdoc +0 -19
- data/doc/webauthn_login.rdoc +0 -16
- data/doc/webauthn_modify_email.rdoc +0 -19
- data/doc/webauthn_verify_account.rdoc +0 -9
@@ -1,37 +0,0 @@
|
|
1
|
-
= Require password confirmation for certain actions
|
2
|
-
|
3
|
-
You might want to require the user to enter their password before accessing
|
4
|
-
sensitive sections of the app. This functionality is provided by the confirm
|
5
|
-
password feature, which accompanied with the password grace period feature will
|
6
|
-
remember the entered password for a period of time:
|
7
|
-
|
8
|
-
plugin :rodauth do
|
9
|
-
enable :confirm_password, :password_grace_period
|
10
|
-
|
11
|
-
# Remember the password for 1 hour
|
12
|
-
password_grace_period 60*60
|
13
|
-
end
|
14
|
-
|
15
|
-
route do |r|
|
16
|
-
r.rodauth
|
17
|
-
|
18
|
-
r.is 'some-action' do
|
19
|
-
# Require password authentication if the password has not been
|
20
|
-
# input recently.
|
21
|
-
rodauth.require_password_authentication
|
22
|
-
|
23
|
-
# ...
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
You can also do this for Rodauth actions that normally require a password.
|
28
|
-
Which essentially moves the password confirmation into a separate step, as
|
29
|
-
Rodauth's behavior with the password grace period feature is to ask for the
|
30
|
-
password on the same form.
|
31
|
-
|
32
|
-
plugin :rodauth do
|
33
|
-
enable :confirm_password, :password_grace_period, :change_login, :change_password
|
34
|
-
|
35
|
-
before_change_login_route { require_password_authentication }
|
36
|
-
before_change_password_route { require_password_authentication }
|
37
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
= Customize password requirements
|
2
|
-
|
3
|
-
By default, Rodauth requires passwords to have at least 6 characters. You can
|
4
|
-
modify the minimum and maximum length:
|
5
|
-
|
6
|
-
plugin :rodauth do
|
7
|
-
enable :login, :logout, :create_account
|
8
|
-
|
9
|
-
# Require passwords to have at least 8 characters
|
10
|
-
password_minimum_length 8
|
11
|
-
|
12
|
-
# Don't allow passwords to be too long, to prevent long password DoS attacks
|
13
|
-
password_maximum_length 64
|
14
|
-
end
|
15
|
-
|
16
|
-
You can use the {disallow common passwords feature}[rdoc-ref:doc/disallow_common_passwords.rdoc]
|
17
|
-
to prevent the usage of common passwords (the most common 10,000 by default).
|
18
|
-
|
19
|
-
You can use additional complexity checks on passwords via the {password
|
20
|
-
complexity feature}[rdoc-ref:doc/password_complexity.rdoc], though most of
|
21
|
-
those complexity checks are no longer considered modern security best
|
22
|
-
practices and are likely to decrease overall security.
|
23
|
-
|
24
|
-
If you want complete control over whether passwords meet requirements, you
|
25
|
-
can use the <tt>password_meets_requirements?</tt> configuration method.
|
26
|
-
|
27
|
-
plugin :rodauth do
|
28
|
-
enable :login, :logout, :create_account
|
29
|
-
|
30
|
-
password_meets_requirements? do |password|
|
31
|
-
super(password) && password_complex_enough?(password)
|
32
|
-
end
|
33
|
-
|
34
|
-
auth_class_eval do
|
35
|
-
# If password doesn't pass custom validation, add field error with error
|
36
|
-
# reason, and return false.
|
37
|
-
def password_complex_enough?(password)
|
38
|
-
return true if password.match?(/\d/) && password.match?(/[^a-zA-Z\d]/)
|
39
|
-
set_password_requirement_error_message(:password_simple, "requires one number and one special character")
|
40
|
-
false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/doc/guides/paths.rdoc
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
= Change route path
|
2
|
-
|
3
|
-
You can change the URL path of any Rodauth route by overriding the
|
4
|
-
corresponding <tt>*_route</tt> method:
|
5
|
-
|
6
|
-
plugin :rodauth do
|
7
|
-
enable :login, :logout, :create_account, :reset_password
|
8
|
-
|
9
|
-
# Change login route to "/signin"
|
10
|
-
login_route "signin"
|
11
|
-
|
12
|
-
# Change redirect when login is required to "/signin"
|
13
|
-
require_login_redirect { login_path }
|
14
|
-
|
15
|
-
# Change create account route to "/register"
|
16
|
-
create_account_route "register"
|
17
|
-
|
18
|
-
# Change password reset request route to "/reset-password/request"
|
19
|
-
reset_password_request_route "reset-password/request"
|
20
|
-
end
|
21
|
-
|
22
|
-
If you want to add a prefix to all Rodauth routes, you should use the +prefix+
|
23
|
-
setting:
|
24
|
-
|
25
|
-
plugin :rodauth do
|
26
|
-
enable :login, :logout
|
27
|
-
|
28
|
-
# Use /auth prefix to each Rodauth route
|
29
|
-
prefix "/auth"
|
30
|
-
end
|
31
|
-
|
32
|
-
route do |r|
|
33
|
-
r.on "auth" do
|
34
|
-
# Serve Rodauth routes under the /auth branch of the routing tree
|
35
|
-
r.rodauth
|
36
|
-
end
|
37
|
-
|
38
|
-
# ...
|
39
|
-
end
|
40
|
-
|
41
|
-
There are cases where you may want to disable certain routes. For example, you
|
42
|
-
may want to enable the create_account feature to allow creating admins, but
|
43
|
-
only make it possible programmatically via internal requests. In this case,
|
44
|
-
you should set the corresponding <tt>*_route</tt> method to +nil+:
|
45
|
-
|
46
|
-
plugin :rodauth, name: :admin do
|
47
|
-
enable :create_account
|
48
|
-
|
49
|
-
# disable the /create-account route
|
50
|
-
create_account_route nil
|
51
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
= Pass query parameters to auth URLs
|
2
|
-
|
3
|
-
The <tt>*_path</tt> and <tt>*_url</tt> methods allow passing additional query parameters:
|
4
|
-
|
5
|
-
rodauth.create_account_path(type: "seller")
|
6
|
-
#=> "/create-account?type=seller"
|
7
|
-
|
8
|
-
rodauth.login_url(type: "operator")
|
9
|
-
#=> "https//example.com/login?type=operator"
|
data/doc/guides/redirects.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= Change redirect destination
|
2
|
-
|
3
|
-
You can change the redirect destination for any Rodauth action by overriding
|
4
|
-
the corresponding <tt>*_redirect</tt> method:
|
5
|
-
|
6
|
-
plugin :rodauth do
|
7
|
-
enable :login, :logout, :create_account, :reset_password
|
8
|
-
|
9
|
-
# Redirect to "/dashboard" after login
|
10
|
-
login_redirect "/dashboard"
|
11
|
-
|
12
|
-
# Redirect to wherever login redirects to after creating account
|
13
|
-
create_account_redirect { login_redirect }
|
14
|
-
|
15
|
-
# Redirect to login page after password reset
|
16
|
-
reset_password_redirect { login_path }
|
17
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
= Add new field during account creation
|
2
|
-
|
3
|
-
The create account form only handles login and password parameters by
|
4
|
-
default. However, you might want to ask for additional information during
|
5
|
-
account creation, such as requiring the user to also enter their full name
|
6
|
-
or their company's name.
|
7
|
-
|
8
|
-
== A) Accounts table
|
9
|
-
|
10
|
-
Let's assume you wanted to wanted to store the additional field(s) directly on
|
11
|
-
the +accounts+ table:
|
12
|
-
|
13
|
-
alter_table :accounts do
|
14
|
-
add_column :name, String
|
15
|
-
end
|
16
|
-
|
17
|
-
You need to override the <tt>create-account</tt> template, which by default in
|
18
|
-
Rodauth you can do by adding a <tt>create-account.erb</tt> template in your
|
19
|
-
Roda +views+ directory.
|
20
|
-
|
21
|
-
Once you've added the <tt>create-account.erb</tt> template, and had it include
|
22
|
-
a field for the +name+, you can handle the submission of that field in a before
|
23
|
-
create account hook:
|
24
|
-
|
25
|
-
plugin :rodauth do
|
26
|
-
enable :login, :logout, :create_account
|
27
|
-
|
28
|
-
before_create_account do
|
29
|
-
# Validate presence of the name field
|
30
|
-
unless name = param_or_nil("name")
|
31
|
-
throw_error_status(422, "name", "must be present")
|
32
|
-
end
|
33
|
-
|
34
|
-
# Assign the new field to the account record
|
35
|
-
account[:name] = name
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
== B) Separate table
|
40
|
-
|
41
|
-
Alternatively, you can store the additional field(s) in separate table, for
|
42
|
-
example:
|
43
|
-
|
44
|
-
create_table :account_names do
|
45
|
-
foreign_key :account_id, :accounts, primary_key: true, type: :Bignum
|
46
|
-
String :name, null: false
|
47
|
-
end
|
48
|
-
|
49
|
-
You can then handle the new submitted field as follows:
|
50
|
-
|
51
|
-
plugin :rodauth do
|
52
|
-
enable :login, :logout, :create_account
|
53
|
-
|
54
|
-
before_create_account do
|
55
|
-
# Validate presence of the name field
|
56
|
-
throw_error_status(422, "name", "must be present") unless param_or_nil("name")
|
57
|
-
end
|
58
|
-
|
59
|
-
after_create_account do
|
60
|
-
# Create the associated record
|
61
|
-
db[:account_names].insert(account_id: account[:id], name: param("name"))
|
62
|
-
end
|
63
|
-
|
64
|
-
after_close_account do
|
65
|
-
# Delete the associated record
|
66
|
-
db[:account_names].where(account_id: account[:id]).delete
|
67
|
-
end
|
68
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
= Render confirmation view
|
2
|
-
|
3
|
-
Most Rodauth actions redirect and display a flash notice after they're successfully performed. However, in some cases you may wish to render a view confirming that the action was successful, for nicer user experience.
|
4
|
-
|
5
|
-
For example, when the user creates an account, you might render a page with a call to action to verify their account. Assuming you've created an +account_created+ view template alongside your other Rodauth templates, you can configure the following:
|
6
|
-
|
7
|
-
after_create_account do
|
8
|
-
# render "account_created" view template with page title of "Account created!"
|
9
|
-
return_response view("account_created", "Account created!")
|
10
|
-
end
|
11
|
-
|
12
|
-
Similarly, when the user has requested a password reset, you can render a page telling them to check their email:
|
13
|
-
|
14
|
-
after_reset_password_request do
|
15
|
-
# render "password_reset_sent" view template with page title of "Password sent!"
|
16
|
-
return_response view("password_reset_sent", "Password sent!")
|
17
|
-
end
|
data/doc/guides/require_mfa.rdoc
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
= Require multifactor authentication after login
|
2
|
-
|
3
|
-
You may want to require multifactor authentication on login for people
|
4
|
-
that have multifactor authentication set up. The +require_authentication+
|
5
|
-
Rodauth method works for pages that require an authenticated user, but not for
|
6
|
-
pages where authentication is optional.
|
7
|
-
|
8
|
-
You can set this up as follows:
|
9
|
-
|
10
|
-
plugin :rodauth do
|
11
|
-
enable :login, :logout, :otp
|
12
|
-
|
13
|
-
# If you don't want to show an error message when redirecting
|
14
|
-
# to the multifactor authentication page.
|
15
|
-
two_factor_need_authentication_error_flash nil
|
16
|
-
|
17
|
-
# Display the same flash message after multifactor
|
18
|
-
# authentication than is displayed after login
|
19
|
-
two_factor_auth_notice_flash { login_notice_flash }
|
20
|
-
end
|
21
|
-
|
22
|
-
route do |r|
|
23
|
-
r.rodauth
|
24
|
-
|
25
|
-
if rodauth.logged_in? && rodauth.two_factor_authentication_setup?
|
26
|
-
rodauth.require_two_factor_authenticated
|
27
|
-
end
|
28
|
-
|
29
|
-
# ...
|
30
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
= Autologin after password reset
|
2
|
-
|
3
|
-
When the user resets their password, by default they are not automatically
|
4
|
-
logged in. You can change this behaviour and login the user automatically
|
5
|
-
after password reset.
|
6
|
-
|
7
|
-
plugin :rodauth do
|
8
|
-
enable :login, :logout, :reset_password
|
9
|
-
|
10
|
-
reset_password_autologin? true
|
11
|
-
end
|
12
|
-
|
13
|
-
Similarly, when the verify login change feature is used, the user is not
|
14
|
-
automatically logged in after verifying the login change. You can configure
|
15
|
-
Rodauth to automatically log the user in in this case:
|
16
|
-
|
17
|
-
plugin :rodauth do
|
18
|
-
enable :login, :logout, :verify_login_change
|
19
|
-
|
20
|
-
verify_login_change_autologin? true
|
21
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
= Share configuration via inheritance
|
2
|
-
|
3
|
-
If you have multiple configurations that needs to share some amount of
|
4
|
-
authentication behaviour, you can do so through inheritance. For example:
|
5
|
-
|
6
|
-
require "rodauth"
|
7
|
-
|
8
|
-
class RodauthBase < Rodauth::Auth
|
9
|
-
configure do
|
10
|
-
# common authentication configuration
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class RodauthMain < RodauthBase # inherit common configuration
|
15
|
-
configure do
|
16
|
-
# main-specific authentication configuration
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class RodauthAdmin < RodauthBase # inherit common configuration
|
21
|
-
configure do
|
22
|
-
# admin-specific authentication configuration
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class RodauthApp < Roda
|
27
|
-
plugin :rodauth, auth_class: RodauthMain
|
28
|
-
plugin :rodauth, auth_class: RodauthAdmin, name: :admin
|
29
|
-
# ...
|
30
|
-
end
|
31
|
-
|
32
|
-
However, when doing this, you need to be careful that you do not use a
|
33
|
-
configuration method in a superclass, and then load a feature in a subclass
|
34
|
-
that overrides the configuration you set in the superclass.
|
@@ -1,28 +0,0 @@
|
|
1
|
-
= Store account status in a text column
|
2
|
-
|
3
|
-
By default, Rodauth recommends using a separate table for account statuses, and
|
4
|
-
linking them via foreign keys. This is useful as it achieves an enum-like
|
5
|
-
behaviour, where the database ensures a constrained set of status values.
|
6
|
-
|
7
|
-
However, if you use a testing environment that starts with a blank database,
|
8
|
-
and don't want to fix your testing environment to support real foreign keys,
|
9
|
-
you can configure Rodauth to store the account status in a text column.
|
10
|
-
Doing so results in problems if a text value you do not expect gets stored
|
11
|
-
in the column. We can mitigate the problems by using a CHECK constraint
|
12
|
-
on the column.
|
13
|
-
|
14
|
-
create_table :accounts do
|
15
|
-
# ...
|
16
|
-
String :status, null: false, default: "verified",
|
17
|
-
check: {status: %w'unverified verified closed'}
|
18
|
-
end
|
19
|
-
|
20
|
-
Then we can configure Rodauth to support this.
|
21
|
-
|
22
|
-
plugin :rodauth do
|
23
|
-
# ...
|
24
|
-
account_status_column :status
|
25
|
-
account_unverified_status_value "unverified"
|
26
|
-
account_open_status_value "verified"
|
27
|
-
account_closed_status_value "closed"
|
28
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
= Allow recovery code on TOTP code field
|
2
|
-
|
3
|
-
If using the otp feature, for convenience you might want to allow
|
4
|
-
the user to enter the recovery code into the TOTP code field, instead
|
5
|
-
of requiring they use the separate recovery codes form. You can
|
6
|
-
implement this using the following configuration:
|
7
|
-
|
8
|
-
plugin :rodauth do
|
9
|
-
enable :login, :logout, :otp, :recovery_codes
|
10
|
-
|
11
|
-
before_otp_auth_route do
|
12
|
-
if recovery_code_match?(param(otp_auth_param))
|
13
|
-
two_factor_authenticate("recovery_code")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/doc/http_basic_auth.rdoc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
= Documentation for HTTP Basic Auth Feature
|
2
|
-
|
3
|
-
The HTTP basic auth feature allows logins using HTTP basic authentication,
|
4
|
-
described in RFC 1945.
|
5
|
-
|
6
|
-
In your routing block, you can require HTTP basic authentication via:
|
7
|
-
|
8
|
-
rodauth.require_http_basic_auth
|
9
|
-
|
10
|
-
If you want to allow HTTP basic authentication but not require it, you can
|
11
|
-
call:
|
12
|
-
|
13
|
-
rodauth.http_basic_auth
|
14
|
-
|
15
|
-
== Auth Value Methods
|
16
|
-
|
17
|
-
http_basic_auth_realm :: The realm to return in the WWW-Authenticate header.
|
18
|
-
require_http_basic_auth? :: If true, when +rodauth.require_login+ or +rodauth.require_authentication+ is used, return a 401 status page if basic auth has not been provided, instead of redirecting to the login page. If false, +rodauth.require_login+ or +rodauth.require_authentication+ will check for HTTP basic authentication if not already logged in. False by default.
|