Skip to content

Switch login from email to username, rename navbar item, fix stylesheet reload bug - #27

Merged
Xenne93 merged 1 commit into
mainfrom
feature/username-login
Aug 19, 2026
Merged

Switch login from email to username, rename navbar item, fix stylesheet reload bug#27
Xenne93 merged 1 commit into
mainfrom
feature/username-login

Conversation

@Xenne93

@Xenne93 Xenne93 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Three changes:

  1. 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.

  2. 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.

  3. 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.

…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.
@Xenne93
Xenne93 merged commit bc830a3 into main Aug 19, 2026
5 of 6 checks passed
@Xenne93
Xenne93 deleted the feature/username-login branch August 19, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant