This issue feels somewhat large; this can be broken up into multiple PRs if desired.
This depends on the PR adding reserved crate names: #13765
This issue is only for the API changes; there is a separate issue for changes to the UI to make use of this new API ability.
In a similar manner as the deleted_crates table, add a deleted_usernames (or abandoned_usernames? because this will be for usernames that someone decided to stop using by changing to something else, not necessarily by deleting their account).
-
Add to update_user a field for username in the JSON
-
Similarly to the validate_crate_name function, create a validate_username function that:
- Only allows usernames to contain alphanumeric characters (
[a-zA-Z0-9]), hyphens (-), and underscores (_).
- Doesn't allow usernames to start with a hyphen or underscore.
- Doesn't allow usernames to exceed 39 characters.
- Returns explanatory errors if any restrictions are violated.
-
Similarly to the check of deleted_crates in crate publishing, verify that:
- The new username is available to use
- The current user changing their name has not changed their name in the past 30 days
-
Similarly to the check of reserved_crate_names in crate publishing, verify that the new username isn't reserved
This issue feels somewhat large; this can be broken up into multiple PRs if desired.
This depends on the PR adding reserved crate names: #13765
This issue is only for the API changes; there is a separate issue for changes to the UI to make use of this new API ability.
In a similar manner as the
deleted_cratestable, add adeleted_usernames(orabandoned_usernames? because this will be for usernames that someone decided to stop using by changing to something else, not necessarily by deleting their account).Add to
update_usera field forusernamein the JSONSimilarly to the
validate_crate_namefunction, create avalidate_usernamefunction that:[a-zA-Z0-9]), hyphens (-), and underscores (_).Similarly to the check of
deleted_cratesin crate publishing, verify that:Similarly to the check of
reserved_crate_namesin crate publishing, verify that the new username isn't reserved