Skip to content

Let users change their sign-in email in the settings - #129

Merged
MacNite merged 1 commit into
mainfrom
claude/funny-mccarthy-hhisr2
Oct 5, 2026
Merged

MacNite merged 1 commit into
mainfrom
claude/funny-mccarthy-hhisr2

Conversation

@MacNite

@MacNite MacNite commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an Email address card to the settings page so users can change the address they sign in with.

  • Confirmation: the user re-enters their current password. The change takes effect immediately, so it works on instances without SMTP.
  • SSO-only accounts (passwordHash === SSO_ONLY_PASSWORD_HASH): the address is shown read-only with a hint that the identity provider manages it. The server action also refuses these accounts (ssoManaged).
  • Notice to the old address: a security email goes to the previous address when SMTP is enabled. It does not include the new address. If sending fails, the error is logged and the change still stands.
  • Rate limit: new RATE_LIMITS.emailChange (5 per 15 min, per account, stored in the database with an in-memory fallback), because the form checks a password.
  • The new address is trimmed and lowercased like at login and registration. A unique-constraint clash returns emailTaken, and an unchanged address returns sameEmail.
  • mail.ts: SMTP transport setup moved into a shared mailTransport() helper, plus the new sendEmailChangedMail.
  • DE/EN translations under settings.email.

No schema change or migration.

Known limitation

Without a confirmation link, nobody checks that the user owns the new address. If OIDC is configured, a user with a password account could set their address to someone else's IdP email. If that person then signs in through SSO for the first time, the email match would link them to this account. They would get into the other user's account, not the other way round. The confirmation-link option was considered and not chosen for now.

Test plan

  • npm run typecheck
  • eslint on changed files
  • vitest run: all pass, including the new src/server/profile-actions.test.ts (success, wrong password, SSO refusal, taken address, invalid or unchanged address, notice failure, rate limit)
  • Manual: change email on a password account, sign out, sign in with the new address
  • Manual: an SSO-only account sees the field read-only

🤖 Generated with Claude Code

https://claude.ai/code/session_01LUaD2yecLFtn7HfUGeaRWR


Generated by Claude Code

A new "Email address" card on the settings page changes the address an
account signs in with, confirmed by the current password so it works on
instances without SMTP. The previous address gets a security notice when
mail is configured; the change stands even if that notice fails.

Accounts created through single sign-on have no password and their address
belongs to the identity provider, so they see it read-only. Attempts are
rate-limited per account, since the form checks a password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LUaD2yecLFtn7HfUGeaRWR
@MacNite
MacNite merged commit 887155d into main Oct 5, 2026
8 checks passed
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.

2 participants