rodauth 2.2.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +50 -0
  3. data/README.rdoc +14 -0
  4. data/doc/base.rdoc +3 -1
  5. data/doc/jwt_refresh.rdoc +13 -0
  6. data/doc/login.rdoc +8 -0
  7. data/doc/login_password_requirements_base.rdoc +3 -0
  8. data/doc/password_pepper.rdoc +44 -0
  9. data/doc/recovery_codes.rdoc +2 -1
  10. data/doc/release_notes/2.3.0.txt +37 -0
  11. data/doc/release_notes/2.4.0.txt +22 -0
  12. data/doc/release_notes/2.5.0.txt +20 -0
  13. data/doc/release_notes/2.6.0.txt +37 -0
  14. data/doc/release_notes/2.7.0.txt +33 -0
  15. data/doc/remember.rdoc +1 -1
  16. data/doc/verify_login_change.rdoc +1 -0
  17. data/javascript/webauthn_auth.js +9 -9
  18. data/javascript/webauthn_setup.js +9 -6
  19. data/lib/rodauth.rb +14 -6
  20. data/lib/rodauth/features/base.rb +19 -4
  21. data/lib/rodauth/features/change_password.rb +1 -1
  22. data/lib/rodauth/features/close_account.rb +8 -6
  23. data/lib/rodauth/features/confirm_password.rb +2 -2
  24. data/lib/rodauth/features/disallow_password_reuse.rb +4 -2
  25. data/lib/rodauth/features/email_auth.rb +1 -1
  26. data/lib/rodauth/features/jwt.rb +11 -3
  27. data/lib/rodauth/features/jwt_refresh.rb +70 -8
  28. data/lib/rodauth/features/login.rb +23 -12
  29. data/lib/rodauth/features/login_password_requirements_base.rb +9 -4
  30. data/lib/rodauth/features/otp.rb +0 -2
  31. data/lib/rodauth/features/password_pepper.rb +45 -0
  32. data/lib/rodauth/features/recovery_codes.rb +22 -1
  33. data/lib/rodauth/features/remember.rb +6 -1
  34. data/lib/rodauth/features/session_expiration.rb +1 -6
  35. data/lib/rodauth/features/verify_account.rb +6 -7
  36. data/lib/rodauth/features/verify_login_change.rb +2 -1
  37. data/lib/rodauth/features/webauthn_login.rb +1 -1
  38. data/lib/rodauth/migrations.rb +16 -5
  39. data/lib/rodauth/version.rb +1 -1
  40. metadata +16 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f672a0312d4a0c6103bb763d339161119551a0e64cc248546a0cb52f4e6784c1
4
- data.tar.gz: 530d322cc3ddba655959238aafe155512de11f090afb9465980181dcc729d1b9
3
+ metadata.gz: ce2af7161a7aaba17ebb25beda65f8598306b2d040986db0be215b89fb683149
4
+ data.tar.gz: cf69c788c9401485610599f0b6996f340ab315fcbceb359bccf01a78dceaadc8
5
5
  SHA512:
6
- metadata.gz: d8018f5e02d077bd8625c17c8c5a1f607b986c1916296132ef68e2651d2af26d65ddbdfdc9b5f1352431c74caa30e94d270cc03840207303f8fa0e6a44910a0b
7
- data.tar.gz: 5f24ce4d800d3bbe914dac40dba1cd68b78af4aff5efdaf976b32702d45b5fe7809453d2a650f407437afb1b9d6206ff3d79e6f703fcd85d8d55a0f0658464eb
6
+ metadata.gz: 8b2d72d0f9338a359653e90829618f2579afc30095bb0dd1bd0c627730c91117158ef5ebbca9a4a32bb78bd312ebbac308a68efb761cf93c4dfc707d7bdcea24
7
+ data.tar.gz: d5eb1fc01df26b8305edec707642d3192e7a5dc3507416d0e60aaf6ffd1b079ac4ddced72a85d61c4623c70df2d784307cfba60b8759741b2991f591c623b0b0
data/CHANGELOG CHANGED
@@ -1,3 +1,53 @@
1
+ === 2.7.0 (2020-12-22)
2
+
3
+ * Avoid method redefinition warnings in verbose warning mode (jeremyevans)
4
+
5
+ * Return expired access token error message in the JWT refresh feature when using an expired token when it isn't allowed (AlexyMatskevich) (#133)
6
+
7
+ * Allow Rodauth features to be preloaded, instead of always trying to require them (janko) (#136)
8
+
9
+ * Use a default remember cookie path of '/', though this may cause problem with multiple Rodauth configurations on the same domain (janko) (#134)
10
+
11
+ * Add auto_remove_recovery_codes? to the recovery_codes feature, for automatically removing the codes when disabling multifactor authentication (SilasSpet, jeremyevans) (#135)
12
+
13
+ === 2.6.0 (2020-11-20)
14
+
15
+ * Avoid loading features multiple times (janko) (#131)
16
+
17
+ * Add around_rodauth method for running code around the handling of all Rodauth routes (bjeanes) (#129)
18
+
19
+ * Fix javascript for registration of multiple webauthn keys (bjeanes) (#127)
20
+
21
+ * Add allow_refresh_with_expired_jwt_access_token? configuration method to jwt_refresh feature, for allowing refresh with expired access token (jeremyevans)
22
+
23
+ * Promote setup_account_verification to public API, useful for automatically sending account verification emails (jeremyevans)
24
+
25
+ === 2.5.0 (2020-10-22)
26
+
27
+ * Add change_login_needs_verification_notice_flash for easier translation of change_login_notice_flash when using verify_login_change (bjeanes, janko, jeremyevans) (#126)
28
+
29
+ * Add login_return_to_requested_location_path for controlling path to use as the requested location (HoneyryderChuck, jeremyevans) (#122, #123)
30
+
31
+ === 2.4.0 (2020-09-21)
32
+
33
+ * Add session_key_prefix for more easily using separate session keys when using multiple configurations (janko) (#121)
34
+
35
+ * Add password_pepper feature for appending a secret key to passwords before they are hashed, supporting secret rotation (janko) (#119)
36
+
37
+ === 2.3.0 (2020-08-21)
38
+
39
+ * Return an error status instead of an invalid access token when trying to refresh JWT without an access token in the jwt_refresh feature (jeremyevans)
40
+
41
+ * Allow {create,drop}_database_authentication_functions to work with UUID keys (monorkin, janko) (#117)
42
+
43
+ * Add rodauth.login('login_type') for logging in after setting a valid account (janko) (#114)
44
+
45
+ * Make new refresh token available to the after_refresh_token hook by setting it in the response first (jeremyevans)
46
+
47
+ * Make the jwt_refresh plugin call before_jwt_refresh_route hook (previously the configuration method was ignored) (AlexeyMatskevich) (#110)
48
+
49
+ * Add login_email_regexp, login_not_valid_email_message, and log_valid_email? configuration methods (janko) (#107)
50
+
1
51
  === 2.2.0 (2020-07-20)
2
52
 
3
53
  * Allow removing all jwt_refresh tokens when logging out by providing a value of "all" as the token to remove (jeremyevans)
@@ -44,6 +44,7 @@ HTML and JSON API for all supported features.
44
44
  * Verify Account Grace Period (Don't require verification before login)
45
45
  * Password Grace Period (Don't require password entry if recently entered)
46
46
  * Password Complexity (More sophisticated checks)
47
+ * Password Pepper
47
48
  * Disallow Password Reuse
48
49
  * Disallow Common Passwords
49
50
  * Password Expiration
@@ -881,6 +882,7 @@ view the appropriate file in the doc directory.
881
882
  * {Password Complexity}[rdoc-ref:doc/password_complexity.rdoc]
882
883
  * {Password Expiration}[rdoc-ref:doc/password_expiration.rdoc]
883
884
  * {Password Grace Period}[rdoc-ref:doc/password_grace_period.rdoc]
885
+ * {Password Pepper}[rdoc-ref:doc/password_pepper.rdoc]
884
886
  * {Recovery Codes}[rdoc-ref:doc/recovery_codes.rdoc]
885
887
  * {Remember}[rdoc-ref:doc/remember.rdoc]
886
888
  * {Reset Password}[rdoc-ref:doc/reset_password.rdoc]
@@ -1062,6 +1064,18 @@ the name as an argument to use that configuration:
1062
1064
  r.rodauth
1063
1065
  end
1064
1066
 
1067
+ By default, alternate configurations will use the same session keys as the
1068
+ primary configuration, which may be undesirable. To ensure session state is
1069
+ separated between configurations, you can set a session key prefix for
1070
+ alternate configurations. If you are using the remember feature in both
1071
+ configurations, you may also want to set a different remember key in the
1072
+ alternate configuration:
1073
+
1074
+ plugin :rodauth, :name=>:secondary do
1075
+ session_key_prefix "secondary_"
1076
+ remember_cookie_key "_secondary_remember"
1077
+ end
1078
+
1065
1079
  === With Password Hashes Inside the Accounts Table
1066
1080
 
1067
1081
  You can use Rodauth if you are storing password hashes in the same
@@ -1,7 +1,7 @@
1
1
  = Documentation for Base Feature
2
2
 
3
3
  The base feature is automatically loaded when you use Rodauth. It contains
4
- shared functionality that is used by multiple features.
4
+ shared functionality that is used by multiple features.
5
5
 
6
6
  == Auth Value Methods
7
7
 
@@ -17,6 +17,7 @@ mark_input_fields_as_required? :: Whether input fields should be marked as requi
17
17
  prefix :: The routing prefix used for Rodauth routes. If you are calling in a routing subtree, this should be set to the root path of the subtree. This should include a leading slash if set, but not a trailing slash.
18
18
  require_bcrypt? :: Set to false to not require bcrypt, useful if using custom authentication.
19
19
  session_key :: The key in the session hash storing the primary key of the logged in account.
20
+ session_key_prefix :: The string that will be prepended to the default value for all session keys.
20
21
  skip_status_checks? :: Whether status checks should be skipped for accounts. Defaults to true unless enabling the verify_account or close_account features.
21
22
  title_instance_variable :: The instance variable to set in the Roda scope with the page title. The layout should use this instance variable if available to set the title of the page. You can use +set_title+ if setting the page title is not done through an instance variable.
22
23
 
@@ -87,6 +88,7 @@ account_session_value :: The primary value of the current account to store in th
87
88
  after_login :: Run arbitrary code after a successful login.
88
89
  after_login_failure :: Run arbitrary code after a login failure due to an invalid password.
89
90
  already_logged_in :: What action to take if you are already logged in and attempt to access a page that only makes sense if you are not logged in.
91
+ around_rodauth(&block) :: Run arbitrary code around handling any rodauth route. Call <tt>super(&block)</tt> for Rodauth to handle the action.
90
92
  authenticated? :: Whether the user has been authenticated. If multifactor authentication has been enabled for the account, this is true only if the session is multifactor authenticated.
91
93
  before_login :: Run arbitrary code after password has been checked, but before updating the session.
92
94
  before_login_attempt :: Run arbitrary code after an account has been located, but before the password has been checked.
@@ -19,23 +19,36 @@ when logging out, provide the refresh token when submitting the JSON request to
19
19
  If you would like to remove all refresh tokens for the account when logging out, provide
20
20
  a value of <tt>all</tt> as the token value.
21
21
 
22
+ When using the refresh token, you must provide a valid access token, as that contains
23
+ information about the current session, which is used to create the new access token.
24
+ If you change the +allow_refresh_with_expired_jwt_access_token?+ setting to +true+,
25
+ an expired but otherwise valid access token will be accepted, and Rodauth will check
26
+ that the access token was issued in the same session as the refresh token.
27
+
22
28
  This feature depends on the jwt feature.
23
29
 
24
30
  == Auth Value Methods
25
31
 
32
+ allow_refresh_with_expired_jwt_access_token? :: Whether refreshing should be allowed with an expired access token. Default is +false+. You must set an +hmac_secret+ if setting this value to +true+.
33
+ expired_jwt_access_token_status :: The HTTP status code to use when a access token (JWT) is expired is submitted in the Authorization header. Default is 400 for backwards compatibility, and it is recommended to set it to 401.
34
+ expired_jwt_access_token_message :: The error message to use when a access token (JWT) is expired is submitted in the Authorization header.
26
35
  jwt_access_token_key :: Name of the key in the response json holding the access token. Default is +access_token+.
27
36
  jwt_access_token_not_before_period :: How many seconds before the current time will the jwt be considered valid (to account for inaccurate clocks). Default is 5.
28
37
  jwt_access_token_period :: Validity of an access token in seconds, default is 1800 (30 minutes).
29
38
  jwt_refresh_route :: The route to the login action. Defaults to <tt>jwt-refresh</tt>.
30
39
  jwt_refresh_invalid_token_message :: Error message when the provided refresh token is non existent, invalid or expired.
31
40
  jwt_refresh_token_account_id_column :: The column name in the +jwt_refresh_token_table+ storing the account id, should be a foreign key referencing the accounts table.
41
+ jwt_refresh_token_data_session_key :: The key in the session hash storing random data, for access checking during refresh if +allow_refresh_with_expired_jwt_access_token?+ is set.
32
42
  jwt_refresh_token_deadline_column :: The column name in the +jwt_refresh_token_table+ storing the deadline after which the refresh token will no longer be valid.
33
43
  jwt_refresh_token_deadline_interval :: Validity of a refresh token. Default is 14 days.
44
+ jwt_refresh_token_hmac_session_key :: The key in the session hash storing the hmac, for access checking during refresh if +allow_refresh_with_expired_jwt_access_token?+ is set.
34
45
  jwt_refresh_token_id_column :: The column name in the refresh token keys table storing the id of each token (the primary key of the table).
35
46
  jwt_refresh_token_key :: Name of the key in the response json holding the refresh token. Default is +refresh_token+.
36
47
  jwt_refresh_token_key_column :: The column name in the +jwt_refresh_token_table+ holding the refresh token key value.
37
48
  jwt_refresh_token_key_param :: Name of parameter in which the refresh token is provided when requesting a new token. Default is +refresh_token+.
38
49
  jwt_refresh_token_table :: Name of the table holding refresh token keys.
50
+ jwt_refresh_without_access_token_message :: Error message when trying to refresh with providing an access token.
51
+ jwt_refresh_without_access_token_status :: The HTTP status code to use when trying to refresh without providing an access token.
39
52
 
40
53
  == Auth Methods
41
54
 
@@ -3,6 +3,13 @@
3
3
  The login feature implements a login page. It's the most commonly
4
4
  used feature.
5
5
 
6
+ In addition to the auth methods below, it provides a +login+ method that wraps
7
+ +login_session+, running login hooks and redirecting to the configured
8
+ location.
9
+
10
+ rodauth.account #=> { id: 123, ... }
11
+ rodauth.login('password') # login the current account
12
+
6
13
  == Auth Value Methods
7
14
 
8
15
  login_additional_form_tags :: HTML fragment containing additional form tags to use on the login form.
@@ -27,4 +34,5 @@ use_multi_phase_login? :: Whether to ask for login first, and only ask for passw
27
34
 
28
35
  before_login_route :: Run arbitrary code before handling a login route.
29
36
  login_view :: The HTML to use for the login form.
37
+ login_return_to_requested_location_path :: If +login_return_to_requested_location?+ is true, the path to use as the requested location. By default, uses the full path of the request for GET requests, and is nil for non-GET requests (in which case the default +login_redirect+ will be used).
30
38
  multi_phase_login_view :: The HTML to use for the login form after login has been entered when using multi phase login.
@@ -9,8 +9,10 @@ already_an_account_with_this_login_message :: The error message to display when
9
9
  login_confirm_label :: The label to use for login confirmations.
10
10
  login_confirm_param :: The parameter name to use for login confirmations.
11
11
  login_does_not_meet_requirements_message :: The error message to display when the login does not meet the requirements you have set.
12
+ login_email_regexp :: The regular expression used to validate whether login is a valid email address.
12
13
  login_maximum_length :: The maximum length for logins, 255 by default.
13
14
  login_minimum_length :: The minimum length for logins, 3 by default.
15
+ login_not_valid_email_message :: The error message to display when login is not a valid email address.
14
16
  login_too_long_message :: The error message fragment to show if the login is too long.
15
17
  login_too_short_message :: The error message fragment to show if the login is too short.
16
18
  logins_do_not_match_message :: The error message to display when login and login confirmation do not match.
@@ -29,6 +31,7 @@ same_as_existing_password_message :: The error message to display when a new pas
29
31
  == Auth Methods
30
32
 
31
33
  login_meets_requirements?(login) :: Whether the given login meets the requirements. By default, just checks that the login is a valid email address.
34
+ login_valid_email?(login) :: Whether the login is a valid email address.
32
35
  password_hash(password) :: A hash of the given password.
33
36
  password_meets_requirements?(password) :: Whether the given password meets the requirements. Can be used to implement complexity requirements for passwords.
34
37
  set_password(password) :: Set the password for the current account to the given password.
@@ -0,0 +1,44 @@
1
+ = Documentation for Password Pepper Feature
2
+
3
+ The password pepper feature appends a specified secret string to passwords
4
+ before they are hashed. This way, if the password hashes get compromised, an
5
+ attacker cannot use them to crack the passwords without also knowing the
6
+ pepper.
7
+
8
+ In the configuration block set the +password_pepper+ with your secret string.
9
+ It's recommended for the password pepper to be at last 32 characters long and
10
+ randomly generated.
11
+
12
+ password_pepper "<long secret key>"
13
+
14
+ If your database already contains password hashes that were created without a
15
+ password pepper, these will get automatically updated with a password pepper
16
+ next time the user successfully enters their password.
17
+
18
+ You can rotate the password pepper as well, just make sure to add the previous
19
+ pepper to the +previous_password_peppers+ array. Password hashes using the old
20
+ pepper will get automatically updated on the next successful password match.
21
+
22
+ password_pepper "new pepper"
23
+ previous_password_peppers ["old pepper", ""]
24
+
25
+ The empty string above ensures password hashes without pepper are handled as
26
+ well.
27
+
28
+ Note that each entry in +previous_password_peppers+ will multiply the amount of
29
+ possible password checks during login, at least for incorrect passwords.
30
+
31
+ Additionally, when using this feature with the disallow_password_reuse feature,
32
+ the number of passwords checked when changing or resetting a password will be
33
+
34
+ (previous_password_peppers.length + 1) * previous_passwords_to_check
35
+
36
+ So if you have 2 entries in +previous_password_peppers+, using the default
37
+ value of 6 for +previous_passwords_to_check+, every time a password
38
+ is changed, there will be 18 password checks done, which will be quite slow.
39
+
40
+ == Auth Value Methods
41
+
42
+ password_pepper :: The secret string appended to passwords before they are hashed.
43
+ previous_password_peppers :: An array of password peppers that will be tried on an unsuccessful password match. Defaults to <tt>[""]</tt>, which allows introducing this feature with existing passwords.
44
+ password_pepper_update? :: Whether to update password hashes that use a pepper from +previous_password_peppers+ with a new pepper. Defaults to +true+.
@@ -17,7 +17,8 @@ add_recovery_codes_error_flash :: The flash error to show when adding recovery c
17
17
  add_recovery_codes_heading :: Text to use for heading above the form to add recovery codes.
18
18
  add_recovery_codes_page_title :: The page title to use on the add recovery codes form.
19
19
  add_recovery_codes_param :: The parameter name to use for adding recovery codes.
20
- auto_add_recovery_codes? :: Whether to automatically add recovery codes (or any missing recovery codes) when another multifactor authentication type is enabled (false by default).
20
+ auto_add_recovery_codes? :: Whether to automatically add recovery codes (or any missing recovery codes) when enabling otp, webauthn, or sms authentication (false by default).
21
+ auto_remove_recovery_codes? :: Whether to automatically remove recovery codes when disabling otp, webauthn, or sms authentication and not having one of the other two authentication methods enabled (false by default).
21
22
  invalid_recovery_code_error_flash :: The flash error to show when an invalid recovery code is used.
22
23
  invalid_recovery_code_message :: The error message to show when an invalid recovery code is used.
23
24
  recovery_auth_additional_form_tags :: HTML fragment containing additional form tags when authenticating via a recovery code.
@@ -0,0 +1,37 @@
1
+ = New Features
2
+
3
+ * Configuration methods have been added for easier validation of
4
+ logins when logins must be valid email addresses (the default):
5
+
6
+ * login_valid_email?(login) can be used for full control of
7
+ determining whether the login is valid.
8
+
9
+ * login_email_regexp can be used to set the regexp used in the
10
+ default login_valid_email? check.
11
+
12
+ * login_not_valid_email_message can be used to set the field
13
+ error message if the login is not a valid email. Previously, this
14
+ value was hardcoded and not translatable.
15
+
16
+ * The {create,drop}_database_authentication_functions now work
17
+ correctly with uuid keys on PostgreSQL. All other parts of
18
+ Rodauth already worked correctly with uuid keys.
19
+
20
+ = Other Improvements
21
+
22
+ * The before_jwt_refresh_route hook is now called before the route
23
+ is taken. Previously, the configuration method had no effect.
24
+
25
+ * rodauth.login can now be used by external code to login the current
26
+ account (the account that rodauth.account returns). This should be
27
+ passed the authentication type string used to login, such as
28
+ password.
29
+
30
+ * The jwt_refresh route now returns an error for requests where a
31
+ valid access token for a logged in session is not provided. You
32
+ can use the jwt_refresh_without_access_token_message and
33
+ jwt_refresh_without_access_token_status configuration methods
34
+ to configure the error response.
35
+
36
+ * The new refresh token is now available to the after_refresh_token
37
+ hook by looking in json_response[jwt_refresh_token_key].
@@ -0,0 +1,22 @@
1
+ = New Features
2
+
3
+ * A password_pepper feature has been added. This allows you to use a
4
+ secret key (called a pepper) to append to passwords before hashing
5
+ and hash checking. Using this approach, if an attacker obtains the
6
+ password hash, it is unusable for cracking unless they can also
7
+ get access to the pepper.
8
+
9
+ The password_pepper feature also supports a list of previous peppers
10
+ that can be used to implement secret rotation and to support
11
+ compatibility with unpeppered passwords.
12
+
13
+ Rodauth by default uses database functions for password hash
14
+ checking on PostgreSQL, MySQL, and Microsoft SQL Server, which in
15
+ general provides more security than a password pepper, but both
16
+ approaches can be used simultaneously.
17
+
18
+ * A session_key_prefix configuration method has been added for
19
+ prefixing the values of all default session keys. This can be
20
+ useful if you are using multiple Rodauth configurations in the same
21
+ application and want to make sure the session keys for the separate
22
+ configurations do not overlap.
@@ -0,0 +1,20 @@
1
+ = New Features
2
+
3
+ * A login_return_to_requested_location_path configuration method has
4
+ been added to the login feature. This controls the path to redirect
5
+ to if using login_return_to_requested_location?. By default, this
6
+ is the same as the fullpath of the request that required login if
7
+ that request was a GET request, and nil if that request was not a
8
+ GET request. Previously, the fullpath of that request was used even
9
+ if it was not a GET request, which caused problems as browsers use a
10
+ GET request for redirects, and it is a bad idea to redirect to a path
11
+ that may not handle GET requests.
12
+
13
+ * A change_login_needs_verification_notice_flash configuration method
14
+ has been added to the verify_login_change feature, for allowing
15
+ translations when using the feature and not using the
16
+ change_login_notice_flash configuration method.
17
+
18
+ = Other Improvements
19
+
20
+ * new_password_label is now translatable.
@@ -0,0 +1,37 @@
1
+ = New Features
2
+
3
+ * An around_rodauth configuration method has been added, which is
4
+ called around all Rodauth actions. This configuration method
5
+ is passed a block, and is useful for cases where you want to wrap
6
+ Rodauth's handling of the request.
7
+
8
+ For example, if you had a method named time_block in your Roda scope
9
+ that timed block execution and added a response header, you could
10
+ time Rodauth actions using something like:
11
+
12
+ around_rodauth do |&block|
13
+ scope.time_block('Rodauth') do
14
+ super(&block)
15
+ end
16
+ end
17
+
18
+ * The allow_refresh_with_expired_jwt_access_token? configuration has
19
+ been added to the jwt_refresh feature, allowing refreshing with an
20
+ expired but otherwise valid access token. When using this method,
21
+ it is required to have an hmac_secret specified, so that Rodauth
22
+ can make sure the access token matches the refresh token.
23
+
24
+ = Other Improvements
25
+
26
+ * The javascript for setting up a WebAuthn token has been fixed to
27
+ allow it to work correctly if there is already an existing
28
+ WebAuthn token for the account.
29
+
30
+ * The rodauth.setup_account_verification method has been promoted to
31
+ public API. You can use this method for automatically sending
32
+ account verification emails when automatically creating accounts.
33
+
34
+ * Rodauth no longer loads the same feature multiple times into a
35
+ single configuration. This didn't cause any problems before, but
36
+ could result in duplicate entries when looking at the loaded
37
+ features.
@@ -0,0 +1,33 @@
1
+ = New Features
2
+
3
+ * An auto_remove_recovery_codes? configuration method has been added
4
+ to the recovery_codes feature. This will automatically remove
5
+ recovery codes when the last multifactor authentication type other
6
+ than the recovery codes has been removed.
7
+
8
+ * The jwt_access_expired_status and expired_jwt_access_token_message
9
+ configuration methods have been added to the jwt_refresh feature,
10
+ for supporting custom statuses and messages for expired tokens.
11
+
12
+ = Other Improvements
13
+
14
+ * Rodauth will no longer attempt to require a feature that has
15
+ already been required. Related to this is you can now use a
16
+ a custom Rodauth feature without a rodauth/features/*.rb file
17
+ in the Ruby library path, as long as you load the feature
18
+ manually.
19
+
20
+ * Rodauth now avoids method redefinition warnings in verbose
21
+ warning mode. As Ruby 3 is dropping uninitialized instance
22
+ variable warnings, Rodauth will be verbose warning free in
23
+ Ruby 3.
24
+
25
+ = Backwards Compatibility
26
+
27
+ * The default remember cookie path is now set to '/'. This fixes
28
+ usage in the case where rodauth is loaded under a subpath of the
29
+ application (which is not the default behavior). Unfortunately,
30
+ this change can negatively affect cases where multiple rodauth
31
+ configurations are used in separate paths on the same domain.
32
+ In these cases, you should now use remember_cookie_options and
33
+ include a :path option.
@@ -35,7 +35,7 @@ raw_remember_token_deadline :: A deadline before which to allow a raw remember t
35
35
  remember_additional_form_tags :: HTML fragment containing additional form tags to use on the change remember setting form.
36
36
  remember_button :: The text to use for the change remember settings button.
37
37
  remember_cookie_key :: The cookie name to use for the remember token.
38
- remember_cookie_options :: Any options to set for the remember cookie.
38
+ remember_cookie_options :: Any options to set for the remember cookie. By default, the `:path` cookie option is set to `/`.
39
39
  remember_deadline_column :: The column name in the +remember_table+ storing the deadline after which the token will be ignored.
40
40
  remember_deadline_interval :: The amount of time for which to remember accounts, 14 days by default. Only used if +set_deadline_values?+ is true.
41
41
  remember_disable_label :: The label for disabling remembering.
@@ -14,6 +14,7 @@ control. Depends on the change login and email base features.
14
14
  == Auth Value Methods
15
15
 
16
16
  no_matching_verify_login_change_key_error_flash :: The flash error message to show when an invalid verify login change key is used.
17
+ change_login_needs_verification_notice_flash :: The flash notice to show after changing a login when using this feature, if +change_login_notice_flash+ is not overridden.
17
18
  verify_login_change_additional_form_tags :: HTML fragment containing additional form tags to use on the verify login change form.
18
19
  verify_login_change_autologin? :: Whether to autologin the user after successful login change verification, false by default.
19
20
  verify_login_change_button :: The text to use for the verify login change button.
@@ -1,34 +1,34 @@
1
1
  (function() {
2
+ var pack = function(v) { return btoa(String.fromCharCode.apply(null, new Uint8Array(v))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); };
3
+ var unpack = function(v) { return Uint8Array.from(atob(v.replace(/-/g, '+').replace(/_/g, '/')), c => c.charCodeAt(0)); };
2
4
  var element = document.getElementById('webauthn-auth-form');
3
5
  var f = function(e) {
4
6
  //console.log(e);
5
7
  e.preventDefault();
6
8
  if (navigator.credentials) {
7
9
  var opts = JSON.parse(element.getAttribute("data-credential-options"));
8
- opts.challenge = Uint8Array.from(atob(opts.challenge.replace(/-/g, '+').replace(/_/g, '/')), c => c.charCodeAt(0));
9
- opts.allowCredentials.forEach(function(cred) {
10
- cred.id = Uint8Array.from(atob(cred.id.replace(/-/g, '+').replace(/_/g, '/')), c => c.charCodeAt(0));
11
- });
10
+ opts.challenge = unpack(opts.challenge);
11
+ opts.allowCredentials.forEach(function(cred) { cred.id = unpack(cred.id); });
12
12
  //console.log(opts);
13
13
  navigator.credentials.get({publicKey: opts}).
14
14
  then(function(cred){
15
15
  //console.log(cred);
16
16
  //window.cred = cred
17
17
 
18
- var rawId = btoa(String.fromCharCode.apply(null, new Uint8Array(cred.rawId))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
18
+ var rawId = pack(cred.rawId);
19
19
  var authValue = {
20
20
  type: cred.type,
21
21
  id: rawId,
22
22
  rawId: rawId,
23
23
  response: {
24
- authenticatorData: btoa(String.fromCharCode.apply(null, new Uint8Array(cred.response.authenticatorData))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''),
25
- clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(cred.response.clientDataJSON))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''),
26
- signature: btoa(String.fromCharCode.apply(null, new Uint8Array(cred.response.signature))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
24
+ authenticatorData: pack(cred.response.authenticatorData),
25
+ clientDataJSON: pack(cred.response.clientDataJSON),
26
+ signature: pack(cred.response.signature)
27
27
  }
28
28
  };
29
29
 
30
30
  if (cred.response.userHandle) {
31
- authValue.response.userHandle = btoa(String.fromCharCode.apply(null, new Uint8Array(cred.response.userHandle))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
31
+ authValue.response.userHandle = pack(cred.response.userHandle);
32
32
  }
33
33
 
34
34
  document.getElementById('webauthn-auth').value = JSON.stringify(authValue);