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.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +146 -0
  3. data/README.rdoc +644 -220
  4. data/Rakefile +99 -11
  5. data/doc/account_expiration.rdoc +55 -0
  6. data/doc/base.rdoc +104 -0
  7. data/doc/change_login.rdoc +29 -0
  8. data/doc/change_password.rdoc +26 -0
  9. data/doc/close_account.rdoc +31 -0
  10. data/doc/confirm_password.rdoc +22 -0
  11. data/doc/create_account.rdoc +34 -0
  12. data/doc/disallow_password_reuse.rdoc +37 -0
  13. data/doc/email_base.rdoc +19 -0
  14. data/doc/jwt.rdoc +35 -0
  15. data/doc/lockout.rdoc +83 -0
  16. data/doc/login.rdoc +27 -0
  17. data/doc/login_password_requirements_base.rdoc +50 -0
  18. data/doc/logout.rdoc +21 -0
  19. data/doc/otp.rdoc +100 -0
  20. data/doc/password_complexity.rdoc +50 -0
  21. data/doc/password_expiration.rdoc +52 -0
  22. data/doc/password_grace_period.rdoc +10 -0
  23. data/doc/recovery_codes.rdoc +60 -0
  24. data/doc/release_notes/1.0.0.txt +443 -0
  25. data/doc/remember.rdoc +82 -0
  26. data/doc/reset_password.rdoc +70 -0
  27. data/doc/session_expiration.rdoc +27 -0
  28. data/doc/single_session.rdoc +43 -0
  29. data/doc/sms_codes.rdoc +119 -0
  30. data/doc/two_factor_base.rdoc +27 -0
  31. data/doc/verify_account.rdoc +70 -0
  32. data/doc/verify_account_grace_period.rdoc +15 -0
  33. data/doc/verify_change_login.rdoc +9 -0
  34. data/lib/roda/plugins/rodauth.rb +3 -262
  35. data/lib/rodauth.rb +260 -0
  36. data/lib/rodauth/features/account_expiration.rb +108 -0
  37. data/lib/rodauth/features/base.rb +479 -0
  38. data/lib/rodauth/features/change_login.rb +77 -0
  39. data/lib/rodauth/features/change_password.rb +66 -0
  40. data/lib/rodauth/features/close_account.rb +82 -0
  41. data/lib/rodauth/features/confirm_password.rb +51 -0
  42. data/lib/rodauth/features/create_account.rb +128 -0
  43. data/lib/rodauth/features/disallow_password_reuse.rb +82 -0
  44. data/lib/rodauth/features/email_base.rb +63 -0
  45. data/lib/rodauth/features/jwt.rb +151 -0
  46. data/lib/rodauth/features/lockout.rb +262 -0
  47. data/lib/rodauth/features/login.rb +61 -0
  48. data/lib/rodauth/features/login_password_requirements_base.rb +123 -0
  49. data/lib/rodauth/features/logout.rb +37 -0
  50. data/lib/rodauth/features/otp.rb +338 -0
  51. data/lib/rodauth/features/password_complexity.rb +89 -0
  52. data/lib/rodauth/features/password_expiration.rb +111 -0
  53. data/lib/rodauth/features/password_grace_period.rb +46 -0
  54. data/lib/rodauth/features/recovery_codes.rb +240 -0
  55. data/lib/rodauth/features/remember.rb +200 -0
  56. data/lib/rodauth/features/reset_password.rb +207 -0
  57. data/lib/rodauth/features/session_expiration.rb +55 -0
  58. data/lib/rodauth/features/single_session.rb +87 -0
  59. data/lib/rodauth/features/sms_codes.rb +498 -0
  60. data/lib/rodauth/features/two_factor_base.rb +135 -0
  61. data/lib/rodauth/features/verify_account.rb +232 -0
  62. data/lib/rodauth/features/verify_account_grace_period.rb +76 -0
  63. data/lib/rodauth/features/verify_change_login.rb +20 -0
  64. data/lib/rodauth/migrations.rb +130 -0
  65. data/lib/rodauth/version.rb +9 -0
  66. data/spec/account_expiration_spec.rb +90 -0
  67. data/spec/all.rb +1 -0
  68. data/spec/change_login_spec.rb +149 -0
  69. data/spec/change_password_spec.rb +177 -0
  70. data/spec/close_account_spec.rb +162 -0
  71. data/spec/confirm_password_spec.rb +70 -0
  72. data/spec/create_account_spec.rb +127 -0
  73. data/spec/disallow_password_reuse_spec.rb +84 -0
  74. data/spec/lockout_spec.rb +228 -0
  75. data/spec/login_spec.rb +188 -0
  76. data/spec/migrate/001_tables.rb +103 -16
  77. data/spec/migrate/002_account_password_hash_column.rb +11 -0
  78. data/spec/migrate_password/001_tables.rb +60 -42
  79. data/spec/migrate_travis/001_tables.rb +116 -0
  80. data/spec/password_complexity_spec.rb +108 -0
  81. data/spec/password_expiration_spec.rb +243 -0
  82. data/spec/password_grace_period_spec.rb +93 -0
  83. data/spec/remember_spec.rb +424 -0
  84. data/spec/reset_password_spec.rb +185 -0
  85. data/spec/rodauth_spec.rb +57 -980
  86. data/spec/session_expiration_spec.rb +58 -0
  87. data/spec/single_session_spec.rb +107 -0
  88. data/spec/spec_helper.rb +202 -0
  89. data/spec/two_factor_spec.rb +1310 -0
  90. data/spec/verify_account_grace_period_spec.rb +135 -0
  91. data/spec/verify_account_spec.rb +142 -0
  92. data/spec/verify_change_login_spec.rb +46 -0
  93. data/spec/views/login.str +2 -2
  94. data/templates/add-recovery-codes.str +2 -0
  95. data/templates/button.str +5 -0
  96. data/templates/change-login.str +5 -18
  97. data/templates/change-password.str +6 -14
  98. data/templates/close-account.str +3 -6
  99. data/templates/confirm-password.str +4 -14
  100. data/templates/create-account.str +6 -30
  101. data/templates/login-confirm-field.str +6 -0
  102. data/templates/login-field.str +6 -0
  103. data/templates/login.str +5 -19
  104. data/templates/logout.str +2 -6
  105. data/templates/otp-auth-code-field.str +6 -0
  106. data/templates/otp-auth.str +8 -0
  107. data/templates/otp-disable.str +6 -0
  108. data/templates/otp-setup.str +21 -0
  109. data/templates/password-confirm-field.str +6 -0
  110. data/templates/password-field.str +6 -0
  111. data/templates/recovery-auth.str +12 -0
  112. data/templates/recovery-codes.str +6 -0
  113. data/templates/remember.str +8 -12
  114. data/templates/reset-password-request.str +2 -2
  115. data/templates/reset-password.str +4 -18
  116. data/templates/sms-auth.str +6 -0
  117. data/templates/sms-code-field.str +6 -0
  118. data/templates/sms-confirm.str +7 -0
  119. data/templates/sms-disable.str +7 -0
  120. data/templates/sms-request.str +5 -0
  121. data/templates/sms-setup.str +12 -0
  122. data/templates/unlock-account-request.str +3 -7
  123. data/templates/unlock-account.str +4 -7
  124. data/templates/verify-account-resend.str +2 -2
  125. data/templates/verify-account.str +2 -6
  126. metadata +191 -29
  127. data/lib/roda/plugins/rodauth/base.rb +0 -428
  128. data/lib/roda/plugins/rodauth/change_login.rb +0 -48
  129. data/lib/roda/plugins/rodauth/change_password.rb +0 -42
  130. data/lib/roda/plugins/rodauth/close_account.rb +0 -42
  131. data/lib/roda/plugins/rodauth/create_account.rb +0 -92
  132. data/lib/roda/plugins/rodauth/lockout.rb +0 -292
  133. data/lib/roda/plugins/rodauth/login.rb +0 -81
  134. data/lib/roda/plugins/rodauth/logout.rb +0 -36
  135. data/lib/roda/plugins/rodauth/remember.rb +0 -226
  136. data/lib/roda/plugins/rodauth/reset_password.rb +0 -205
  137. data/lib/roda/plugins/rodauth/verify_account.rb +0 -228
@@ -0,0 +1,10 @@
1
+ = Documentation for Password Grace Period Feature
2
+
3
+ The password grace period feature keeps track of the last time the
4
+ user entered their password, and doesn't require they reenter their
5
+ password for account modifications if they recently entered it correctly.
6
+
7
+ == Auth Value Methods
8
+
9
+ password_grace_period :: The number of seconds after a password entry until password reentry is required, 300 by default (5 minutes).
10
+ last_password_entry_session_key :: The session key in which to store the last password entry time.
@@ -0,0 +1,60 @@
1
+ = Documentation for Recovery Codes Feature
2
+
3
+ The recovery codes feature allows 2nd factor authentication via single use recovery
4
+ codes. It is usually used as a backup if OTP authentication is not available or
5
+ has been locked out, but can be used by itself or as a backup to SMS codes. It allows
6
+ users to view authentication recovery codes as well as regenerate recovery codes.
7
+
8
+ == Auth Value Methods
9
+
10
+ add_recovery_codes_button :: Text to use for button on form to add recovery codes.
11
+ add_recovery_codes_error_flash :: The flash error to show when adding recovery codes.
12
+ add_recovery_codes_param :: The parameter name to use for adding recovery codes.
13
+ add_recovery_auth_redirect :: Where to redirect to add recovery codes if recovery codes
14
+ are the primary 2nd factor and have not been setup yet.
15
+ invalid_recovery_code_error_flash :: The flash error to show when an invalid recovery
16
+ code is used.
17
+ invalid_recovery_code_message :: The error message to show when an invalid recovery code
18
+ is used.
19
+ recovery_auth_additional_form_tags :: HTML fragment containing additional form tags when
20
+ authenticating via a recovery code.
21
+ recovery_auth_button :: The text to use for the button when authenticating via a recovery code.
22
+ recovery_auth_redirect :: Where to redirect after authenticating via an recovery code.
23
+ recovery_auth_route :: The route to the recovery code authentication action.
24
+ recovery_codes_added_notice_flash :: The flash notice to show when recovery codes
25
+ were added.
26
+ recovery_codes_additional_form_tags :: HTML fragment containing additional form tags when
27
+ adding recovery codes.
28
+ recovery_codes_column :: The column in the recovery_codes_table containing the recovery
29
+ code.
30
+ recovery_codes_id_column :: The column in the recovery_codes_table containing the
31
+ account id.
32
+ recovery_codes_label :: The label for recovery codes.
33
+ recovery_codes_limit :: The number of recovery codes to allow.
34
+ recovery_codes_param :: The parameter name for the recovery code.
35
+ recovery_codes_primary? :: Whether recovery codes are the primary second factor, true by
36
+ default if neither the otp or sms_codes features are enabled.
37
+ recovery_codes_route :: The route to the view recovery codes action.
38
+ recovery_codes_table :: The table storing the recovery codes.
39
+ view_recovery_codes_button :: Text for the button to view recovery codes.
40
+ view_recovery_codes_error_flash :: The flash error to show when viewing recovery codes
41
+ was not successful.
42
+
43
+ == Auth Methods
44
+
45
+ add_recovery_code :: Add a recovery code for the given account.
46
+ add_recovery_codes_view :: The HTML to use for the add recovery codes form.
47
+ after_add_recovery_codes :: Run arbitrary code after adding recovery codes.
48
+ before_add_recovery_codes :: Run arbitrary code before adding recovery codes.
49
+ before_recovery_auth :: Run arbitrary code before recovery authentication.
50
+ before_recovery_auth_route :: Run arbitrary code before handling recovery authentication route.
51
+ before_recovery_codes_route :: Run arbitrary code before handling view/add recovery codes route.
52
+ before_view_recovery_codes :: Run arbitrary code before viewing recovery codes.
53
+ can_add_recovery_codes? :: Whether the current account can add more recovery codes.
54
+ new_recovery_code :: A new recovery code to insert into the recovery codes table.
55
+ recovery_auth_view :: The HTML to use for the form to authenticate via a recovery code.
56
+ recovery_code_match?(code) :: Whether the given code matches any of the existing
57
+ recovery_codes.
58
+ recovery_codes :: An array containing all valid recovery codes for the current
59
+ account.
60
+ recovery_codes_view :: The HTML to use for the form to view recovery codes.
@@ -0,0 +1,443 @@
1
+ = Highlights
2
+
3
+ * Two factor authentication support via TOTP, SMS, and recovery codes
4
+ * Support for any database supported by Sequel
5
+ * Full security support on PostgreSQL, MySQL, and MSSQL
6
+ * Full support for all features via JSON APIs, using JWT tokens
7
+ * Support for common IT security policies:
8
+ * Password complexity checks
9
+ * Disallowing reuse of recent passwords
10
+ * Password expiration
11
+ * Account expiration
12
+ * Session expiration
13
+ * Limiting accounts to a single session
14
+
15
+ = Backwards Compatibility
16
+
17
+ * Rodauth now defaults to skipping status checks on accounts unless
18
+ the verify account or close account features are used. Previously,
19
+ skip_status_checks? was false by default regardless of which
20
+ features were in use.
21
+
22
+ * Rodauth no longer uses Sequel::Models for accounts, all database
23
+ access is done through Sequel datasets. Users should switch to
24
+ using the db, accounts_table, and account_select configuration
25
+ methods if needed. The account_model configuration method still
26
+ exists for backwards compatibility, but it just warns and calls
27
+ those methods.
28
+
29
+ * The account_id_value configuration method has been renamed to
30
+ account_id.
31
+
32
+ * The account_id and account_status_id configuration methods have
33
+ been renamed to account_id_column and account_status_column. This
34
+ is more consistent with other features, which use *_column for
35
+ column names.
36
+
37
+ * Before hooks (e.g. before_login) are executed before actions that
38
+ change state. Before route hooks (e.g. before_login_route) have
39
+ been added and are now called in the same place as the previous
40
+ before hooks.
41
+
42
+ * Rodauth now uses flash errors instead of flash notices if the
43
+ message is not specifically a success message. For example,
44
+ if a login is required and the user is redirected to a login
45
+ page, a flash error is used instead of a flash notice.
46
+
47
+ * Field errors are now stored in the rodauth object instead of
48
+ instance variables in the Roda scope. This will affect you if you
49
+ were doing custom overrides of Rodauth's templates and were
50
+ expecting errors in instance variables. You can now retrieve a
51
+ field error using something like rodauth.field_error('login'), where
52
+ the argument is the related parameter name.
53
+
54
+ * Rodauth now requires bcrypt by default. If you are not using
55
+ bcrypt for authentication, you should set the following in your
56
+ Rodauth configuration:
57
+
58
+ require_bcrypt? false
59
+
60
+ * Rodauth now requires mail by default if using the lockout, reset
61
+ password, or verify account features. If you are using a custom
62
+ mail library, you should set the following in your Rodauth
63
+ configuration:
64
+
65
+ require_mail? false
66
+
67
+ * Rodauth now asks for the current password by default on all
68
+ account modification forms (such as change password). You can
69
+ disable this by setting modifications_require_password? to false.
70
+
71
+ * In the lockout feature, unlock_account_autologin? is now true by
72
+ default. Previously, it was false by default, which left open a
73
+ persistent denial of service attack if the account could be locked
74
+ out between when the account was unlocked and when the user could
75
+ login again.
76
+
77
+ You can now set unlock_account_requires_password? to true if you
78
+ want to check for the current password when unlocking the account.
79
+ However, if you are enabling password resets, this doesn't add
80
+ any security as anyone controlling the email address could reset
81
+ their password before unlocking the account.
82
+
83
+ * Rodauth now requires that logins are valid email addresses and at
84
+ least 3 or more characters by default. You can set
85
+ require_email_address_logins? to false to not require email
86
+ address logins, and login_minimum_length to set the minimum
87
+ length for logins. You can also have custom login requirement
88
+ checks by overriding login_meets_requirements?.
89
+
90
+ * Changing and resetting passwords now checks that the new password
91
+ is not the same as the existing password. Similarly, changing
92
+ logins now checks that the new login is not the same as the
93
+ existing login.
94
+
95
+ * create_account_autologin? is now true by default unless using the
96
+ verify_account feature, and verify_account_autologin? is now
97
+ true by default.
98
+
99
+ * Rodauth features are now stored under lib/rodauth/features instead
100
+ of under lib/roda/plugins/rodauth. Additionally, Rodauth features
101
+ should now go under the Rodauth namespace instead of the
102
+ Roda::RodaPlugins::Rodauth namespace. Also, Rodauth's internal APIs
103
+ have changed significantly to make it easier to create features.
104
+
105
+ Anyone using external Rodauth features needs to update them to
106
+ work with the new path structure, namespacing, and APIs.
107
+
108
+ * The ability to override specific routes in the routing tree has
109
+ been removed from Rodauth. Previously, you could use configuration
110
+ methods such as login_post_route to override Rodauth's handling of
111
+ POST /login. These methods no longer exist. Instead of using them,
112
+ you should just override the appropriate route in your routing tree
113
+ before calling r.rodauth.
114
+
115
+ * Rodauth now requires securerandom on initialization. Previously,
116
+ it did not require securerandom unless/until it was needed. As
117
+ all rack session handlers require securerandom, and all supported
118
+ ruby versions support securerandom, this should only affect you if
119
+ you are using a custom session handler that does not use
120
+ securerandom and your ruby implementation does not support
121
+ securerandom.
122
+
123
+ * Many Rodauth::Auth methods have been made private. Previously most
124
+ methods were public as the internal routing blocks were evaluated
125
+ in the Roda scope instead of the context of the Rodauth::Auth
126
+ object.
127
+
128
+ Additionally, if the feature defines a private method but you
129
+ override it with a configuration method, the overridden method now
130
+ remains private.
131
+
132
+ * The password confirmation part of the remember feature has been
133
+ split off into a separate confirm password feature with its own
134
+ route, and most of the configuration method names have changed to
135
+ reflect this.
136
+
137
+ * The routes to request an account unlock, request a password reset,
138
+ and resend the verify account email have been split into their own
139
+ routes, instead of using the same route names and handling requests
140
+ differently based on whether certain parameters were submitted.
141
+
142
+ * Per-request route names are no longer supported due to an
143
+ optimization. If you really need per-request route names, please
144
+ open an issue and they can be brought back as an option.
145
+
146
+ * Support for Roda < 2.6 has been dropped.
147
+
148
+ = New Features
149
+
150
+ * An OTP feature has been added for 2nd factor authentication via TOTP
151
+ (Time-Based One-Time Password, RFC 6238). This allows TOTP setup,
152
+ including displaying a QR code that can be scanned via a mobile
153
+ phone, authentication via TOTP authentication codes, and disabling
154
+ of TOTP authentication.
155
+
156
+ * An SMS codes feature has been added for backup 2nd factor
157
+ authentication via authentication codes sent in SMS messages. This
158
+ supports registering a mobile phone number, confirming that you can
159
+ receive authentication codes on the mobile phone number, requesting
160
+ an SMS authentication code, input of the SMS authentication code,
161
+ and disabling of SMS authentication.
162
+
163
+ As ruby has many different SMS libraries, and robust SMS gateways
164
+ generally require payments, Rodauth does not actually send the
165
+ SMS messages itself, any user using the SMS codes feature needs to
166
+ use the sms_send configuration method:
167
+
168
+ sms_send do |phone_number, message|
169
+ SomeSMSLibrary.send(phone_number, message)
170
+ end
171
+
172
+ * A recovery codes feature has been added for backup 2nd factor
173
+ authentication via single-use account recovery codes. This supports
174
+ viewing existing recovery codes, as well as generating additional
175
+ recovery codes.
176
+
177
+ * A JWT feature has been added, which adds JSON API support for all
178
+ features that ship with Rodauth. By default, authentication data
179
+ is stored in JWT tokens that are passed via the Authorization
180
+ headers in the request and response.
181
+
182
+ A POST-only JSON API is used, where submitted parameters should
183
+ use the same names as the browser would use, all of which are
184
+ configurable using Rodauth's configuration methods. By default,
185
+ unsuccessful requests receive a 400 status code with a JSON
186
+ object body with "error" and possibly "field-error" entries,
187
+ and successful requests receive a 200 status code with an empty
188
+ JSON object body.
189
+
190
+ * A password complexity feature has been added for configurable
191
+ password complexity checks, such as:
192
+
193
+ * Contains characters in multiple character groups (default 3),
194
+ unless the password is over a given length (default 11).
195
+
196
+ * Does not contain common character or number sequences such as
197
+ qwerty and 123.
198
+
199
+ * Does not contain a certain number of repeating characters
200
+ (default 3).
201
+
202
+ * Does not contain a dictionary word, after stripping of numbers
203
+ from the start and end of the password, and replacing common
204
+ character substitutions (0 for o, $ for s).
205
+
206
+ * A disallow password reuse feature has been added, which stores
207
+ previous password hashes in addition to current passwords hashes,
208
+ and does not allow a user to reuse a recent password (by default,
209
+ any of their last 6).
210
+
211
+ Previous password hashes are stored with the same security as the
212
+ current password hash, so by default on PostgreSQL, MySQL, and
213
+ Microsoft SQL Server, the application's database account does not
214
+ have access to read them and must use database functions to
215
+ retrieve the salts, compute hashes, and check if the hashes match.
216
+
217
+ * A password expiration feature has been added, which requires that
218
+ users change their password after a given amount of time (default
219
+ is 90 days). It also supports not allowing password changes
220
+ until a given amount of time after the last password change, to
221
+ prevent users from quickly rotating their password back to their
222
+ original password if disallowing password reuse.
223
+
224
+ By default, passwords are only checked for expiration on login.
225
+ If you want to check passwords on every access, you can use:
226
+
227
+ rodauth.require_current_password
228
+
229
+ at the appropriate point in your routing block. If a password
230
+ has expired, the user will be redirected to the change password
231
+ form.
232
+
233
+ * An account expiration feature has been added, which disallows
234
+ access to accounts after an amount of time since last login or
235
+ activity. The default is to only track login times, and expire
236
+ accounts based on their last login time. However, if you allow
237
+ long running sessions, this may not provide an accurate picture
238
+ of the last time the account was used. If you want to expire
239
+ accounts based on last activity, you should set
240
+ expire_account_on_last_activity? to true and use:
241
+
242
+ rodauth.update_last_activity
243
+
244
+ at the appropriate place in your routing block. This method
245
+ is fairly expensive as it requires database access every time
246
+ it is called.
247
+
248
+ * A single session feature has been added, which limits each
249
+ account to a single logged in session. Upon any login to
250
+ an account, any previous session will no longer be valid. To
251
+ make sure that this is enforced, you need to use:
252
+
253
+ rodauth.check_single_session
254
+
255
+ at the appropriate place in your routing block. This method
256
+ is fairly expensive as it requires database access every time
257
+ it is called.
258
+
259
+ * A session expiration feature has been added, which can
260
+ automatically expire sessions based on inactivity (default
261
+ 30 minutes) and max lifetime (default 1 day) checks. To make
262
+ sure that session expiration is enforced, you need to use:
263
+
264
+ rodauth.check_session_expiration
265
+
266
+ at the appropriate place in your routing block.
267
+
268
+ * A password grace period feature has been added, which makes it
269
+ so passwords are not needed for account changes if the password
270
+ has been entered recently (default 5 minutes).
271
+
272
+ * A verify account grace period feature has been added, which
273
+ automatically logs accounts in on account creation, and allows
274
+ them to login without verification for a period of time after
275
+ creation (default 1 day). After the time period has expired,
276
+ the account cannot log in until it has been verified.
277
+
278
+ * A verify change login feature has been added, which requires
279
+ that accounts that change logins reverify they have access to the
280
+ new email address. This depends on the verify account grace
281
+ period feature, and allows them to continue to use the account
282
+ during the grace period, but after the grace period has expired,
283
+ they can no longer log in until the account has been reverified.
284
+
285
+ = Other Improvements
286
+
287
+ * All of Rodauth's features should now work on any database that
288
+ Sequel supports, and Rodauth is fully tested on PostgreSQL, MySQL,
289
+ SQLite, and Microsoft SQL Server. Rodauth's full security support,
290
+ which prevents the application database account from accessing
291
+ password hashes, is fully tested on PostgreSQL, MySQL, and Microsoft
292
+ SQL Server.
293
+
294
+ * r.rodauth is now O(1) instead of O(N) where N is the number of
295
+ rodauth routes.
296
+
297
+ * Rodauth now uses a timing-safe algorithm for all token comparisons,
298
+ avoiding possible timing attacks on tokens.
299
+
300
+ * Rodauth now supports rodauth.authenticated? method for checking if
301
+ the user has been authenticated. If the user has setup two
302
+ factor authentication, this checks that the user has been
303
+ authenticated via two factors. rodauth.require_authentication has
304
+ also been added, which redirects the user to the appropriate
305
+ authentication page if they have not been authenticated.
306
+
307
+ * All of Rodauth's routes for modifying accounts, such as change
308
+ password, now require the user be authenticated via two factors if
309
+ they have setup two factor authentication.
310
+
311
+ * You can now disable login/password confirmation by setting
312
+ require_login_confirmation? and require_password_confirmation? to
313
+ false. This is useful when using the JSON API support, where
314
+ confirmation checks would generally be done client side.
315
+
316
+ * Rodauth now supports a set_deadline_values? method for whether to
317
+ set deadline values for tokens explicitly on a per-request basis,
318
+ and *_interval configuration methods for how long to set such
319
+ deadlines:
320
+
321
+ set_deadline_values? true
322
+ account_lockouts_deadline_interval :days=>2
323
+ remember_deadline_interval :days=>60
324
+ reset_password_deadline_interval :days=>7
325
+
326
+ In order for this feature to work, Rodauth will load Sequel's
327
+ date_arithmetic extension into the Sequel::Database object it
328
+ uses. Note that set_deadline_values? defaults to true on MySQL,
329
+ as MySQL does not support non-constant column defaults.
330
+
331
+ * Rodauth supports more specific password requirement error
332
+ messages, showing which specific password requirement was
333
+ not met.
334
+
335
+ * A reset_password_deadline_column method has been added for
336
+ overriding the column name used to store the reset password
337
+ deadlines.
338
+
339
+ * Many configuration methods were added to the remember feature
340
+ to control the parameter names and labels used. Configuration
341
+ methods were also added for flash notices and errors in the
342
+ remember feature.
343
+
344
+ * rodauth.load_memory in the remember feature now checks that the
345
+ account is still active. Previously, the remember feature could
346
+ be used to log into inactive accounts if the accounts remember
347
+ token was not correctly deleted. Additionally, any invalid
348
+ tokens in cookies will result in the removal of the cookie.
349
+
350
+ * When extend_remember_deadline? is used, rodauth.load_memory
351
+ correctly extends the deadline to be based on the current
352
+ timestamp, and also updates the cookie instead of just updating
353
+ the database.
354
+
355
+ * The close account feature now supports a delete_account_on_close?
356
+ option, which will delete accounts after closing them.
357
+
358
+ * The close account feature now works correctly when skipping
359
+ status checks or when using account_password_hash_column.
360
+
361
+ * A password_hash_id_column has been added for specifying the
362
+ account id column in the password hash table.
363
+
364
+ * A token separator configuration method has been, to override the
365
+ default token separator of "_".
366
+
367
+ * You can now add your own methods easily to the rodauth object
368
+ via auth_class_eval:
369
+
370
+ plugin :rodauth do
371
+ enable :login, :logout
372
+
373
+ after_login do
374
+ log('logged in')
375
+ end
376
+
377
+ after_logout do
378
+ log('logged out')
379
+ end
380
+
381
+ auth_class_eval do
382
+ def log(msg)
383
+ LOGGER.info("#{account[:email]} #{msg}")
384
+ end
385
+ end
386
+ end
387
+
388
+ The auth_class_eval block is evaluated in the context of the
389
+ Rodauth::Auth class that the rodauth plugin builds. Methods you
390
+ define in this block are then callable on the rodauth object
391
+ inside the routing tree block.
392
+
393
+ * Rodauth now only allows requesting an account unlock if the
394
+ account is currently locked out.
395
+
396
+ * If an account is locked out during login, the appropriate error
397
+ message is now displayed immediately, instead of waiting until the
398
+ next request.
399
+
400
+ * Rodauth now does better error handling in the lockout, reset
401
+ password and verify account features. Previously, users may have
402
+ received 404 errors when using invalid tokens in these features.
403
+
404
+ * Rodauth now uses separate templates for shared form input fields,
405
+ making it easier to override handling of individual fields
406
+ without overriding entire templates.
407
+
408
+ * Rodauth now supports authentication without database functions
409
+ when using the recommended schema of storing password hashes
410
+ in a separate table. Previously, if database functions were not
411
+ used, Rodauth only supported storing password hashes in the same
412
+ table as the accounts.
413
+
414
+ * Creating the database authentication functions that Rodauth uses
415
+ can now be done by requiring rodauth/migrations and calling the
416
+ Rodauth.create_database_authentication_functions method with the
417
+ appropriate Sequel::Database object.
418
+
419
+ * You no longer need to call super() in before and after hooks.
420
+
421
+ * Rodauth now handles race conditions related to unique constraint
422
+ violations where it is possible to do so. In the cases where it
423
+ is not possible to handle the race condition correctly, an
424
+ exception will still be raised.
425
+
426
+ * Non-integer account ids now work correctly in tokens.
427
+
428
+ * Rodauth now uses frozen string literals by default on ruby 2.3
429
+
430
+ * The random_key and password_hash_cost default methods have been
431
+ made faster by using conditionals to define separate methods,
432
+ instead of conditionals inside the methods.
433
+
434
+ * As Rodauth can now be used in JSON API only mode, the gem
435
+ dependencies are limited to roda and sequel. When used outside
436
+ of JSON API only mode, it also requires tilt and rack_csrf.
437
+
438
+ * Rodauth.version has been added for getting the version of
439
+ Rodauth in use.
440
+
441
+ * Travis-CI is now used for continuous integration testing on ruby
442
+ 1.8.7-2.3.0, JRuby 1.7 (1.8 and 1.9 modes), and JRuby 9.0, using
443
+ PostgreSQL, MySQL, and SQLite.