Switch login from email to username, rename navbar item, fix stylesheet reload bug - #27
Merged
Conversation
…et reload bug - Login is now by username instead of email. Email becomes fully optional everywhere (setup, moderator creation, RequireUniqueEmail disabled) - only needed if you want the "forgot password" email-recovery flow - Identity resolution (ClaimsPrincipalExtensions.GetUser, SecurityBindingMiddleware) now keys on the user's Id instead of email, since email may not exist. This also means changing your email no longer invalidates your current session - removed the forced logout that used to be needed for that - Fixed a bug this surfaced: SecurityController.ChangeEmail was calling SetUserNameAsync with the new email, silently overwriting the user's chosen username on every email change - Existing accounts (created before username-based login existed, whose username was silently set equal to their email) are prompted once with a blocking modal to pick a real username on next login, same pattern as the existing Display Name gate - added HasChosenUsername to track this - Added a Username field to Account Settings (Security page) alongside the existing Display Name/Change Email fields - Emergency CLI password-reset tool (--reset-password, for admins with no working SMTP) now looks up the account by username instead of email - Renamed the "Security" navbar/dropdown item and page title to "Account Settings", since it now covers general account info too - Stylesheet loading fix: added onerror-triggered retry-with-backoff (and eventual full reload) to the two local stylesheet <link> tags, to recover automatically from a failed CSS request instead of requiring a manual refresh - most often hit after the browser/machine has been idle for hours and the network hasn't fully reconnected when the tab wakes up Tested end-to-end in Docker: legacy account forced through the username gate and logging in with the old email-shaped username no longer working afterward, email changes no longer forcing a logout (and username surviving the change), a fresh setup wizard with no email at all, and moderator creation without an email.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three changes:
Login switched from email to username, and email is now fully optional everywhere (setup, moderators). Identity resolution now keys on the user's Id instead of email (GetUser, SecurityBindingMiddleware), which as a side effect means changing your email no longer forces a logout - removed that workaround, and fixed a bug it revealed: ChangeEmail was silently overwriting the user's username with their new email via a leftover SetUserNameAsync call. Existing accounts (whose username was auto-set to their email) get a one-time forced prompt to pick a real username, same pattern as the existing Display Name gate. The emergency CLI password-reset tool now looks up by username too.
Renamed 'Security' to 'Account Settings' in the navbar dropdown and page title, since the page now covers general account info (username/display name/email) alongside security settings.
Stylesheet reload fix: added onerror-triggered retry-with-backoff (then a full reload as a last resort) to the local CSS tags, to recover from a failed stylesheet request automatically instead of needing a manual refresh - most likely to hit after the browser/machine has been idle for hours.
Tested end-to-end in Docker: a legacy account forced through the username gate (confirmed the old email-shaped username stops working afterward), change-email no longer forcing a logout with username surviving the change, a fresh setup with no email at all, and moderator creation without one.