rodauth 0.10.0 → 1.0.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/CHANGELOG +146 -0
- data/README.rdoc +644 -220
- data/Rakefile +99 -11
- data/doc/account_expiration.rdoc +55 -0
- data/doc/base.rdoc +104 -0
- data/doc/change_login.rdoc +29 -0
- data/doc/change_password.rdoc +26 -0
- data/doc/close_account.rdoc +31 -0
- data/doc/confirm_password.rdoc +22 -0
- data/doc/create_account.rdoc +34 -0
- data/doc/disallow_password_reuse.rdoc +37 -0
- data/doc/email_base.rdoc +19 -0
- data/doc/jwt.rdoc +35 -0
- data/doc/lockout.rdoc +83 -0
- data/doc/login.rdoc +27 -0
- data/doc/login_password_requirements_base.rdoc +50 -0
- data/doc/logout.rdoc +21 -0
- data/doc/otp.rdoc +100 -0
- data/doc/password_complexity.rdoc +50 -0
- data/doc/password_expiration.rdoc +52 -0
- data/doc/password_grace_period.rdoc +10 -0
- data/doc/recovery_codes.rdoc +60 -0
- data/doc/release_notes/1.0.0.txt +443 -0
- data/doc/remember.rdoc +82 -0
- data/doc/reset_password.rdoc +70 -0
- data/doc/session_expiration.rdoc +27 -0
- data/doc/single_session.rdoc +43 -0
- data/doc/sms_codes.rdoc +119 -0
- data/doc/two_factor_base.rdoc +27 -0
- data/doc/verify_account.rdoc +70 -0
- data/doc/verify_account_grace_period.rdoc +15 -0
- data/doc/verify_change_login.rdoc +9 -0
- data/lib/roda/plugins/rodauth.rb +3 -262
- data/lib/rodauth.rb +260 -0
- data/lib/rodauth/features/account_expiration.rb +108 -0
- data/lib/rodauth/features/base.rb +479 -0
- data/lib/rodauth/features/change_login.rb +77 -0
- data/lib/rodauth/features/change_password.rb +66 -0
- data/lib/rodauth/features/close_account.rb +82 -0
- data/lib/rodauth/features/confirm_password.rb +51 -0
- data/lib/rodauth/features/create_account.rb +128 -0
- data/lib/rodauth/features/disallow_password_reuse.rb +82 -0
- data/lib/rodauth/features/email_base.rb +63 -0
- data/lib/rodauth/features/jwt.rb +151 -0
- data/lib/rodauth/features/lockout.rb +262 -0
- data/lib/rodauth/features/login.rb +61 -0
- data/lib/rodauth/features/login_password_requirements_base.rb +123 -0
- data/lib/rodauth/features/logout.rb +37 -0
- data/lib/rodauth/features/otp.rb +338 -0
- data/lib/rodauth/features/password_complexity.rb +89 -0
- data/lib/rodauth/features/password_expiration.rb +111 -0
- data/lib/rodauth/features/password_grace_period.rb +46 -0
- data/lib/rodauth/features/recovery_codes.rb +240 -0
- data/lib/rodauth/features/remember.rb +200 -0
- data/lib/rodauth/features/reset_password.rb +207 -0
- data/lib/rodauth/features/session_expiration.rb +55 -0
- data/lib/rodauth/features/single_session.rb +87 -0
- data/lib/rodauth/features/sms_codes.rb +498 -0
- data/lib/rodauth/features/two_factor_base.rb +135 -0
- data/lib/rodauth/features/verify_account.rb +232 -0
- data/lib/rodauth/features/verify_account_grace_period.rb +76 -0
- data/lib/rodauth/features/verify_change_login.rb +20 -0
- data/lib/rodauth/migrations.rb +130 -0
- data/lib/rodauth/version.rb +9 -0
- data/spec/account_expiration_spec.rb +90 -0
- data/spec/all.rb +1 -0
- data/spec/change_login_spec.rb +149 -0
- data/spec/change_password_spec.rb +177 -0
- data/spec/close_account_spec.rb +162 -0
- data/spec/confirm_password_spec.rb +70 -0
- data/spec/create_account_spec.rb +127 -0
- data/spec/disallow_password_reuse_spec.rb +84 -0
- data/spec/lockout_spec.rb +228 -0
- data/spec/login_spec.rb +188 -0
- data/spec/migrate/001_tables.rb +103 -16
- data/spec/migrate/002_account_password_hash_column.rb +11 -0
- data/spec/migrate_password/001_tables.rb +60 -42
- data/spec/migrate_travis/001_tables.rb +116 -0
- data/spec/password_complexity_spec.rb +108 -0
- data/spec/password_expiration_spec.rb +243 -0
- data/spec/password_grace_period_spec.rb +93 -0
- data/spec/remember_spec.rb +424 -0
- data/spec/reset_password_spec.rb +185 -0
- data/spec/rodauth_spec.rb +57 -980
- data/spec/session_expiration_spec.rb +58 -0
- data/spec/single_session_spec.rb +107 -0
- data/spec/spec_helper.rb +202 -0
- data/spec/two_factor_spec.rb +1310 -0
- data/spec/verify_account_grace_period_spec.rb +135 -0
- data/spec/verify_account_spec.rb +142 -0
- data/spec/verify_change_login_spec.rb +46 -0
- data/spec/views/login.str +2 -2
- data/templates/add-recovery-codes.str +2 -0
- data/templates/button.str +5 -0
- data/templates/change-login.str +5 -18
- data/templates/change-password.str +6 -14
- data/templates/close-account.str +3 -6
- data/templates/confirm-password.str +4 -14
- data/templates/create-account.str +6 -30
- data/templates/login-confirm-field.str +6 -0
- data/templates/login-field.str +6 -0
- data/templates/login.str +5 -19
- data/templates/logout.str +2 -6
- data/templates/otp-auth-code-field.str +6 -0
- data/templates/otp-auth.str +8 -0
- data/templates/otp-disable.str +6 -0
- data/templates/otp-setup.str +21 -0
- data/templates/password-confirm-field.str +6 -0
- data/templates/password-field.str +6 -0
- data/templates/recovery-auth.str +12 -0
- data/templates/recovery-codes.str +6 -0
- data/templates/remember.str +8 -12
- data/templates/reset-password-request.str +2 -2
- data/templates/reset-password.str +4 -18
- data/templates/sms-auth.str +6 -0
- data/templates/sms-code-field.str +6 -0
- data/templates/sms-confirm.str +7 -0
- data/templates/sms-disable.str +7 -0
- data/templates/sms-request.str +5 -0
- data/templates/sms-setup.str +12 -0
- data/templates/unlock-account-request.str +3 -7
- data/templates/unlock-account.str +4 -7
- data/templates/verify-account-resend.str +2 -2
- data/templates/verify-account.str +2 -6
- metadata +191 -29
- data/lib/roda/plugins/rodauth/base.rb +0 -428
- data/lib/roda/plugins/rodauth/change_login.rb +0 -48
- data/lib/roda/plugins/rodauth/change_password.rb +0 -42
- data/lib/roda/plugins/rodauth/close_account.rb +0 -42
- data/lib/roda/plugins/rodauth/create_account.rb +0 -92
- data/lib/roda/plugins/rodauth/lockout.rb +0 -292
- data/lib/roda/plugins/rodauth/login.rb +0 -81
- data/lib/roda/plugins/rodauth/logout.rb +0 -36
- data/lib/roda/plugins/rodauth/remember.rb +0 -226
- data/lib/roda/plugins/rodauth/reset_password.rb +0 -205
- data/lib/roda/plugins/rodauth/verify_account.rb +0 -228
data/Rakefile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "rake"
|
|
2
2
|
require "rake/clean"
|
|
3
3
|
|
|
4
|
-
CLEAN.include ["rodauth-*.gem", "rdoc", "coverage"]
|
|
4
|
+
CLEAN.include ["rodauth-*.gem", "rdoc", "coverage", "www/public/rdoc", "www/public/*.html"]
|
|
5
5
|
|
|
6
6
|
# Packaging
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ end
|
|
|
12
12
|
|
|
13
13
|
### RDoc
|
|
14
14
|
|
|
15
|
-
RDOC_DEFAULT_OPTS = ["--line-numbers", "--inline-source", '--title', 'Rodauth: Authentication
|
|
15
|
+
RDOC_DEFAULT_OPTS = ["--line-numbers", "--inline-source", '--title', 'Rodauth: Authentication and Account Management Framework for Rack Applications']
|
|
16
16
|
|
|
17
17
|
begin
|
|
18
18
|
gem 'hanna-nouveau'
|
|
@@ -44,11 +44,11 @@ task :default=>:spec
|
|
|
44
44
|
|
|
45
45
|
spec = proc do |env|
|
|
46
46
|
env.each{|k,v| ENV[k] = v}
|
|
47
|
-
sh "#{FileUtils::RUBY} spec/
|
|
47
|
+
sh "#{FileUtils::RUBY} spec/all.rb"
|
|
48
48
|
env.each{|k,v| ENV.delete(k)}
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
desc "Run specs"
|
|
51
|
+
desc "Run specs on PostgreSQL"
|
|
52
52
|
task "spec" do
|
|
53
53
|
spec.call({})
|
|
54
54
|
end
|
|
@@ -66,12 +66,13 @@ task "spec_w" do
|
|
|
66
66
|
sh %{#{rake} 2>&1 | egrep -v \": warning: instance variable @.* not initialized|: warning: method redefined; discarding old|: warning: previous definition of|: warning: statement not reached"}
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
desc "Setup database used for testing"
|
|
70
|
-
task :
|
|
71
|
-
sh '
|
|
72
|
-
sh '
|
|
69
|
+
desc "Setup database used for testing on PostgreSQL"
|
|
70
|
+
task :db_setup_postgres do
|
|
71
|
+
sh 'psql -U postgres -c "CREATE USER rodauth_test PASSWORD \'rodauth_test\'"'
|
|
72
|
+
sh 'psql -U postgres -c "CREATE USER rodauth_test_password PASSWORD \'rodauth_test\'"'
|
|
73
73
|
sh 'createdb -U postgres -O rodauth_test rodauth_test'
|
|
74
|
-
sh '
|
|
74
|
+
sh 'psql -U postgres -c "CREATE EXTENSION citext" rodauth_test'
|
|
75
|
+
$: << 'lib'
|
|
75
76
|
require 'sequel'
|
|
76
77
|
Sequel.extension :migration
|
|
77
78
|
Sequel.postgres(:user=>'rodauth_test', :password=>'rodauth_test') do |db|
|
|
@@ -82,9 +83,96 @@ task :db_setup do
|
|
|
82
83
|
end
|
|
83
84
|
end
|
|
84
85
|
|
|
85
|
-
desc "Teardown database used for testing"
|
|
86
|
-
task :
|
|
86
|
+
desc "Teardown database used for testing on MySQL"
|
|
87
|
+
task :db_teardown_postgres do
|
|
87
88
|
sh 'dropdb -U postgres rodauth_test'
|
|
88
89
|
sh 'dropuser -U postgres rodauth_test_password'
|
|
89
90
|
sh 'dropuser -U postgres rodauth_test'
|
|
90
91
|
end
|
|
92
|
+
|
|
93
|
+
desc "Setup database used for testing on MySQL"
|
|
94
|
+
task :db_setup_mysql do
|
|
95
|
+
sh 'mysql --user=root -p mysql < spec/sql/mysql_setup.sql'
|
|
96
|
+
$: << 'lib'
|
|
97
|
+
require 'sequel'
|
|
98
|
+
Sequel.extension :migration
|
|
99
|
+
Sequel.mysql2('rodauth_test', :user=>'rodauth_test_password', :password=>'rodauth_test') do |db|
|
|
100
|
+
Sequel::Migrator.run(db, 'spec/migrate')
|
|
101
|
+
end
|
|
102
|
+
Sequel.mysql2('rodauth_test', :user=>'rodauth_test_password', :password=>'rodauth_test') do |db|
|
|
103
|
+
Sequel::Migrator.run(db, 'spec/migrate_password', :table=>'schema_info_password')
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
desc "Teardown database used for testing on MySQL"
|
|
108
|
+
task :db_teardown_mysql do
|
|
109
|
+
sh 'mysql --user=root -p mysql < spec/sql/mysql_teardown.sql'
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
desc "Setup database used for testing on Microsoft SQL Server"
|
|
113
|
+
task :db_setup_mssql do
|
|
114
|
+
sh 'sqlcmd -E -e -b -r1 -i spec\\sql\\mssql_setup.sql'
|
|
115
|
+
$: << 'lib'
|
|
116
|
+
require 'sequel'
|
|
117
|
+
Sequel.extension :migration
|
|
118
|
+
Sequel.tinytds('rodauth_test', :user=>'rodauth_test_password', :password=>'rodauth_test') do |db|
|
|
119
|
+
Sequel::Migrator.run(db, 'spec/migrate')
|
|
120
|
+
end
|
|
121
|
+
Sequel.tinytds('rodauth_test', :user=>'rodauth_test_password', :password=>'rodauth_test') do |db|
|
|
122
|
+
Sequel::Migrator.run(db, 'spec/migrate_password', :table=>'schema_info_password')
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
desc "Teardown database used for testing on Microsoft SQL Server"
|
|
127
|
+
task :db_teardown_mssql do
|
|
128
|
+
sh 'sqlcmd -E -e -b -r1 -i spec\\sql\\mssql_teardown.sql'
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
desc "Run specs on MySQL"
|
|
132
|
+
task :spec_mysql do
|
|
133
|
+
spec.call('RODAUTH_SPEC_DB'=>'mysql2://rodauth_test:rodauth_test@localhost/rodauth_test')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
task :spec_travis do
|
|
137
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
|
138
|
+
pg_db = 'jdbc:postgresql://localhost/rodauth_test?user=postgres'
|
|
139
|
+
my_db = "jdbc:mysql://localhost/rodauth_test?user=root"
|
|
140
|
+
else
|
|
141
|
+
pg_db = 'postgres:///rodauth_test?user=postgres'
|
|
142
|
+
my_db = "mysql2://localhost/rodauth_test?user=root"
|
|
143
|
+
end
|
|
144
|
+
sh 'psql -U postgres -c "CREATE EXTENSION citext" rodauth_test'
|
|
145
|
+
spec.call('RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>pg_db)
|
|
146
|
+
spec.call('RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>my_db)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
desc "Run specs on SQLite"
|
|
150
|
+
task :spec_sqlite do
|
|
151
|
+
spec_db = if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
|
152
|
+
'jdbc:sqlite::memory:'
|
|
153
|
+
else
|
|
154
|
+
'sqlite:/'
|
|
155
|
+
end
|
|
156
|
+
spec.call('RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>spec_db)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
### Website
|
|
160
|
+
|
|
161
|
+
rdoc_task_class.new(:website_rdoc) do |rdoc|
|
|
162
|
+
rdoc.rdoc_dir = "www/public/rdoc"
|
|
163
|
+
rdoc.options += RDOC_OPTS
|
|
164
|
+
rdoc.rdoc_files.add RDOC_FILES
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
desc "Make local version of website"
|
|
168
|
+
task :website_base do
|
|
169
|
+
sh %{#{FileUtils::RUBY} -I lib www/make_www.rb}
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
desc "Make local version of website, with rdoc"
|
|
173
|
+
task :website => [:website_base, :website_rdoc]
|
|
174
|
+
|
|
175
|
+
desc "Serve local version of website via rackup"
|
|
176
|
+
task :serve => :website do
|
|
177
|
+
sh %{#{FileUtils::RUBY} -C www -S rackup}
|
|
178
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
= Documentation for Account Expiration Feature
|
|
2
|
+
|
|
3
|
+
The account expiration feature disallows access to accounts after
|
|
4
|
+
a configurable amount of time since the last login or activity
|
|
5
|
+
(default: 180 days since last login). By default, this feature
|
|
6
|
+
does not track activity times as that can slow things down, but if
|
|
7
|
+
you want to record activity times, you can do so by adding the
|
|
8
|
+
following code to your routing block:
|
|
9
|
+
|
|
10
|
+
rodauth.update_last_activity
|
|
11
|
+
|
|
12
|
+
Note that it only makes sense to do this if you are also expiring
|
|
13
|
+
accounts based on last activity instead of last login, via the
|
|
14
|
+
+expire_account_on_last_activity?+ configuration setting.
|
|
15
|
+
|
|
16
|
+
Note that this feature does not support the reenabling of expired
|
|
17
|
+
accounts, that is something you would have to implement yourself,
|
|
18
|
+
if you need such a feature.
|
|
19
|
+
|
|
20
|
+
== Auth Value Methods
|
|
21
|
+
|
|
22
|
+
account_activity_expired_column :: The column in the +account_activity_table+
|
|
23
|
+
storing the expiration timestamp.
|
|
24
|
+
account_activity_id_column :: The column in the +account_activity_table+
|
|
25
|
+
storing the account id.
|
|
26
|
+
account_activity_last_activity_column :: The column in the +account_activity_table+
|
|
27
|
+
storing the last activity timestamp.
|
|
28
|
+
account_activity_last_login_column :: The column in the +account_activity_table+
|
|
29
|
+
storing the last login timestamp.
|
|
30
|
+
account_activity_table :: The database table use for storing account
|
|
31
|
+
login/activity/expiration timestamps.
|
|
32
|
+
account_expiration_error_flash :: The flash error to show when attempting to
|
|
33
|
+
login to an account that has expired.
|
|
34
|
+
account_expiration_redirect :: Where to redirect after attempting to login to
|
|
35
|
+
an account that has expired.
|
|
36
|
+
expire_account_after :: How long in seconds from last login or activity until
|
|
37
|
+
an account is considered expired.
|
|
38
|
+
expire_account_on_last_activity? :: Whether to use the last activity timestamp
|
|
39
|
+
when checking an account for expiration.
|
|
40
|
+
By default, this is false and it uses the
|
|
41
|
+
last login timestamp.
|
|
42
|
+
|
|
43
|
+
== Auth Methods
|
|
44
|
+
|
|
45
|
+
account_expired? :: Whether the current account has expired.
|
|
46
|
+
account_expired_at :: The expiration timestamp for the current account, nil if the
|
|
47
|
+
account hasn't been expired.
|
|
48
|
+
after_account_expiration :: Run arbitrary code after account expiration.
|
|
49
|
+
last_account_activity_at :: The last activity timestamp for the current account, nil if
|
|
50
|
+
the account hasn't had activity recorded yet.
|
|
51
|
+
last_account_login_at :: The last login timestamp for the current account, nil if
|
|
52
|
+
the account hasn't had a login recorded yet.
|
|
53
|
+
set_expired :: Set the current account as having expired.
|
|
54
|
+
update_last_activity :: Update the last activity timestamp for the account.
|
|
55
|
+
update_last_login :: Update the last login timestamp for the account.
|
data/doc/base.rdoc
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
= Documentation for Base Feature
|
|
2
|
+
|
|
3
|
+
The base feature is automatically loaded when you use Rodauth. It contains
|
|
4
|
+
shared functionality that is used by multiple features.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
=== Most Commonly Used
|
|
9
|
+
|
|
10
|
+
accounts_table :: The database table containing the accounts.
|
|
11
|
+
account_password_hash_column :: Set if the password hash column is in the same
|
|
12
|
+
table as the login. If this is set, Rodauth
|
|
13
|
+
will check the password hash in ruby. This is
|
|
14
|
+
often used if you are replacing a legacy
|
|
15
|
+
authentication system with Rodauth.
|
|
16
|
+
db :: The Sequel::Database object used for database access.
|
|
17
|
+
prefix :: The routing prefix used for Rodauth routes. If you are calling
|
|
18
|
+
in a routing subtree, this should be set to the root path of the
|
|
19
|
+
subtree.
|
|
20
|
+
require_bcrypt? :: Set to false to not require bcrypt, useful if using custom
|
|
21
|
+
authentication.
|
|
22
|
+
session_key :: The key in the session hash storing the primary key of the
|
|
23
|
+
logged in account.
|
|
24
|
+
skip_status_checks? :: Whether status checks should be skipped for accounts.
|
|
25
|
+
Defaults to false unless enabling the verify_account
|
|
26
|
+
or close_account features.
|
|
27
|
+
title_instance_variable :: The instance variable to set in the Roda scope with
|
|
28
|
+
the page title. The layout should use this instance
|
|
29
|
+
variable if available to set the title of the page.
|
|
30
|
+
|
|
31
|
+
=== Other
|
|
32
|
+
|
|
33
|
+
account_id_column :: The primary key column of the account model.
|
|
34
|
+
account_open_status_value :: The integer representing open accounts.
|
|
35
|
+
account_select :: An array of columns to select from +accounts_table+. By
|
|
36
|
+
default, selects all columns in the table.
|
|
37
|
+
account_status_column :: The status id column in the account model.
|
|
38
|
+
account_unverified_status_value :: The representating unverified accounts.
|
|
39
|
+
default_redirect :: Where to redirect after most successful actions.
|
|
40
|
+
invalid_password_message :: The error message to display when a given
|
|
41
|
+
password doesn't match the stored password hash.
|
|
42
|
+
login_column :: The login column in the account model.
|
|
43
|
+
login_label :: The label to use for logins.
|
|
44
|
+
login_param :: The parameter name to use for logins.
|
|
45
|
+
modifications_require_password? :: Whether making changes to an account requires
|
|
46
|
+
the user reinputing their password.
|
|
47
|
+
no_matching_login_message :: The error message to display when the login
|
|
48
|
+
used is not in the database.
|
|
49
|
+
password_hash_column :: The password hash column in the password hash table.
|
|
50
|
+
password_hash_id_column :: The account id column in the password hash table.
|
|
51
|
+
password_hash_table :: The table storing the password hashes.
|
|
52
|
+
password_label :: The label to use for passwords.
|
|
53
|
+
password_param :: The parameter name to use for passwords.
|
|
54
|
+
require_login_error_flash :: The flash error to display when accessing a
|
|
55
|
+
page that requires a login, when you are not
|
|
56
|
+
logged in.
|
|
57
|
+
require_login_redirect :: A redirect to the login page.
|
|
58
|
+
set_deadline_values? :: Whether deadline values should be set. True by default
|
|
59
|
+
on MySQL, as that doesn't support default values that
|
|
60
|
+
are not constant. Can be set to true on other databases
|
|
61
|
+
if you want to vary the value based on a request parameter.
|
|
62
|
+
use_date_arithmetic? :: Whether the date_arithmetic extension should be loaded into
|
|
63
|
+
the database. Defaults to whether deadline values should
|
|
64
|
+
be set.
|
|
65
|
+
use_database_authentication_functions? :: Whether to use functions to do authentication.
|
|
66
|
+
True by default on PostgreSQL, false otherwise.
|
|
67
|
+
|
|
68
|
+
== Auth Methods
|
|
69
|
+
|
|
70
|
+
before_rodauth :: Run arbitrary code before handling any rodauth route.
|
|
71
|
+
account_from_login(login) :: Retrieve the account model instance related to the
|
|
72
|
+
given login or nil if no login matches.
|
|
73
|
+
account_from_session :: Retrieve the account model instance related to the currently
|
|
74
|
+
logged in session.
|
|
75
|
+
account_id :: The primary key value of the current account
|
|
76
|
+
account_session_value :: The primary value of the account currently stored in the
|
|
77
|
+
session.
|
|
78
|
+
already_logged_in :: What action to take if you are already logged in and attempt
|
|
79
|
+
to access a page that only makes sense if you are not logged in.
|
|
80
|
+
authenticated? :: Whether the user has been authenticated. If 2 factor authentication
|
|
81
|
+
has not been enabled for the account, this is true only if both
|
|
82
|
+
factors have been authenticated.
|
|
83
|
+
clear_session :: Clears the current session.
|
|
84
|
+
csrf_tag :: The HTML fragment containing the CSRF tag to use, if any.
|
|
85
|
+
function_name(name) :: The name of the database function to call. It's passed either
|
|
86
|
+
:rodauth_get_salt or :rodauth_valid_password_hash.
|
|
87
|
+
logged_in? :: Whether there is an account currently logged in.
|
|
88
|
+
login_required :: Action to take when a login is required to access the page and
|
|
89
|
+
the user is not logged in.
|
|
90
|
+
open_account? :: Whether the current account is an open account (not closed or
|
|
91
|
+
unverified).
|
|
92
|
+
password_match?(password) :: Check whether the given password matches the
|
|
93
|
+
stored password hash.
|
|
94
|
+
random_key :: A randomly generated string, used for creating tokens.
|
|
95
|
+
redirect(path) :: Redirect the request to the given path.
|
|
96
|
+
session_value :: Alias for account_session_value.
|
|
97
|
+
set_error_flash(message) :: Set the current error flash to the given message.
|
|
98
|
+
set_notice_flash(message) :: Set the next notice flash to the given message.
|
|
99
|
+
set_notice_now_flash(message) :: Set the current notice flash to the given message.
|
|
100
|
+
set_redirect_error_flash(message) :: Set the next error flash to the given message.
|
|
101
|
+
set_title(title) :: Set the title of the page to the given title.
|
|
102
|
+
unverified_account_message :: The message to use when attempting to login to an
|
|
103
|
+
unverified account.
|
|
104
|
+
update_session :: Set the session key to the primary key of the current account.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
= Documentation for Change Login Feature
|
|
2
|
+
|
|
3
|
+
The change login feature implements a form that a user can use to
|
|
4
|
+
change their login.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
change_login_additional_form_tags :: HTML fragment containing additional
|
|
9
|
+
form tags to use on the change login
|
|
10
|
+
form.
|
|
11
|
+
change_login_button :: The text to use for the change login button.
|
|
12
|
+
change_login_error_flash :: The flash error to show for an unsuccessful
|
|
13
|
+
login change.
|
|
14
|
+
change_login_notice_flash :: The flash notice to show after a successful
|
|
15
|
+
login change.
|
|
16
|
+
change_login_redirect :: Where to redirect after a sucessful login change.
|
|
17
|
+
change_login_requires_password? :: Whether a password is required when
|
|
18
|
+
changing logins.
|
|
19
|
+
change_login_route :: The route to the change login action.
|
|
20
|
+
|
|
21
|
+
== Auth Methods
|
|
22
|
+
|
|
23
|
+
after_change_login :: Run arbitrary code after successful login change.
|
|
24
|
+
before_change_login :: Run arbitrary code before changing a login.
|
|
25
|
+
before_change_login_route :: Run arbitrary code before handling a change login route.
|
|
26
|
+
change_login(login) :: Change the users login to the given login, or
|
|
27
|
+
return nil/false if the login cannot be changed to
|
|
28
|
+
the given login.
|
|
29
|
+
change_login_view :: The HTML to use for the change login form.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
= Documentation for Change Password Feature
|
|
2
|
+
|
|
3
|
+
The change password feature implements a form that a user can use to
|
|
4
|
+
change their password.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
change_password_additional_form_tags :: HTML fragment containing additional
|
|
9
|
+
form tags to use on the change password
|
|
10
|
+
form.
|
|
11
|
+
change_password_button :: The text to use for the change password button.
|
|
12
|
+
change_password_error_flash :: The flash error to show for an unsuccessful
|
|
13
|
+
password change.
|
|
14
|
+
change_password_notice_flash :: The flash notice to show after a successful
|
|
15
|
+
password change.
|
|
16
|
+
change_password_redirect :: Where to redirect after a sucessful password change.
|
|
17
|
+
change_password_requires_password? :: Whether a password is required when
|
|
18
|
+
changing passwords.
|
|
19
|
+
change_password_route :: The route to the change password action.
|
|
20
|
+
|
|
21
|
+
== Auth Methods
|
|
22
|
+
|
|
23
|
+
after_change_password :: Run arbitrary code after successful password change.
|
|
24
|
+
before_change_password :: Run arbitrary code before changing the password for an account.
|
|
25
|
+
before_change_password_route :: Run arbitrary code before handling a change password route.
|
|
26
|
+
change_password_view :: The HTML to use for the change password form.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
= Documentation for Close Account Feature
|
|
2
|
+
|
|
3
|
+
The close account feature allows users to close their accounts.
|
|
4
|
+
|
|
5
|
+
== Auth Value Methods
|
|
6
|
+
|
|
7
|
+
account_closed_status_value :: The integer representing closed accounts.
|
|
8
|
+
close_account_additional_form_tags :: HTML fragment containing additional
|
|
9
|
+
form tags to use on the close account
|
|
10
|
+
form.
|
|
11
|
+
close_account_button :: The text to use for the close account button.
|
|
12
|
+
close_account_notice_flash :: The flash notice to show after closing the
|
|
13
|
+
account.
|
|
14
|
+
close_account_redirect :: Where to redirect after closing the account.
|
|
15
|
+
close_account_requires_password? :: Whether a password is required when
|
|
16
|
+
closing accounts.
|
|
17
|
+
close_account_route :: The route to the close account action.
|
|
18
|
+
delete_account_on_close? :: Whether to delete the account when closing it,
|
|
19
|
+
default value is to use +skip_status_checks?+.
|
|
20
|
+
|
|
21
|
+
== Auth Methods
|
|
22
|
+
|
|
23
|
+
after_close_account :: Run arbitrary code after closing the account.
|
|
24
|
+
before_close_account :: Run arbitrary code before closing an account.
|
|
25
|
+
before_close_account_route :: Run arbitrary code before handling a close account route.
|
|
26
|
+
close_account :: Close the account, by default setting the account status
|
|
27
|
+
to closed.
|
|
28
|
+
close_account_view :: The HTML to use for the close account form.
|
|
29
|
+
delete_account :: If +delete_account_on_close?+ is true, delete the account
|
|
30
|
+
when closing it.
|
|
31
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
= Documentation for Confirm Password Feature
|
|
2
|
+
|
|
3
|
+
The confirm password feature allows you to redirect users to a page to
|
|
4
|
+
confirm their password. It's used by the remember feature, but can also
|
|
5
|
+
by your application if you want to confirm passwords.
|
|
6
|
+
|
|
7
|
+
== Auth Value Methods
|
|
8
|
+
|
|
9
|
+
confirm_password_additional_form_tags :: HTML fragment containing additional form tags to use on the confirm password form.
|
|
10
|
+
confirm_password_button :: The text to use for the confirm password button.
|
|
11
|
+
confirm_password_error_flash :: The flash error to show if password confirmation is unsuccessful.
|
|
12
|
+
confirm_password_notice_flash :: The flash notice to show after password confirmed successful.
|
|
13
|
+
confirm_password_redirect :: Where to redirect after successful password confirmation. By default, uses <tt>session[:confirm_password_redirect]</tt> if set, allowing an easy way to redirect back to the page requesting password confirmation.
|
|
14
|
+
confirm_password_route :: The route to the confirm password form.
|
|
15
|
+
|
|
16
|
+
== Auth Methods
|
|
17
|
+
|
|
18
|
+
after_confirm_password :: Run arbitrary code after successful confirmation of password.
|
|
19
|
+
before_confirm_password :: Run arbitrary code before setting that the password has been confirmed.
|
|
20
|
+
confirm_password :: Run arbitrary code on correct password confirmation.
|
|
21
|
+
before_confirm_password_route :: Run arbitrary code before handling the password confirmation route.
|
|
22
|
+
confirm_password_view :: The HTML to use for the confirm password form.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
= Documentation for Create Account Feature
|
|
2
|
+
|
|
3
|
+
The create account feature allows users to create new accounts.
|
|
4
|
+
|
|
5
|
+
== Auth Value Methods
|
|
6
|
+
|
|
7
|
+
create_account_additional_form_tags :: HTML fragment containing additional
|
|
8
|
+
form tags to use on the create account
|
|
9
|
+
form.
|
|
10
|
+
create_account_button :: The text to use for the create account button.
|
|
11
|
+
create_account_error_flash :: The flash error to show for unsuccessful
|
|
12
|
+
account creation.
|
|
13
|
+
create_account_notice_flash :: The flash notice to show after successful
|
|
14
|
+
create_account_redirect :: Where to redirect after creating the account.
|
|
15
|
+
create_account_route :: The route to the create account action.
|
|
16
|
+
account creation.
|
|
17
|
+
|
|
18
|
+
== Auth Methods
|
|
19
|
+
|
|
20
|
+
after_create_account :: Run arbitrary code after creating the account.
|
|
21
|
+
before_create_account :: Run arbitrary code before creating the account.
|
|
22
|
+
before_create_account_route :: Run arbitrary code before handling a create account route.
|
|
23
|
+
create_account_autologin? :: Whether to autologin the user upon
|
|
24
|
+
successful account creation, true by default unless verifying
|
|
25
|
+
accounts.
|
|
26
|
+
create_account_link :: HTML fragment to display with a link to the create
|
|
27
|
+
account form.
|
|
28
|
+
create_account_view :: The HTML to use for the create account form.
|
|
29
|
+
new_account(login) :: Instantiate a new account model instance for the
|
|
30
|
+
given login, without saving it.
|
|
31
|
+
save_account :: Insert the account into the database, or return nil/false if that
|
|
32
|
+
was not successful.
|
|
33
|
+
set_new_account_password :: Set the password for a new account if
|
|
34
|
+
+account_password_hash_column+ is set, without saving.
|