feat: email-only auth with username login - #83
Open
gdccyuen wants to merge 1 commit into
Open
Conversation
- Adopt better-auth username() plugin: real unique username column + displayUsername, signIn.username() for login - Registration now sends username (in addition to name) to signUp.email - Login form: username + password only (email field removed) - Remove Google/GitHub OAuth (server config, env vars, UI components, callback routes) and magic-link login (plugin, client, UI) - Remove Apple login stub (callback page + config flag) - Settings: relabel profile field to Display name (still edits name) - Migration: add username/displayUsername columns to user table - i18n (en/zh): drop OAuth/magic-link strings, add displayName
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.
What
Restricts dashboard authentication to email/password only and makes username the login identifier instead of email.
username()plugin)Changes
Username login (better-auth
username()plugin)lib/auth.ts: addedusername({ minUsernameLength: 2 })pluginlib/better-auth-client.ts: addedusernameClient()lib/db/auth-schema.ts+drizzle/0010_wet_omega_red.sql:username(unique) +displayUsernamecolumns onuserapp/(auth)/register/page.tsx: registration now passesusernametosignUp.emailapp/(auth)/login/_components/username-login-form.tsx(renamed fromemail-login-form.tsx): username + password fields only, password mode always onapp/(auth)/login/_hooks/use-login-actions.ts:signIn.username({ username, password })Removed login methods
socialProvidersblock (github/google) deleted fromlib/auth.ts;oauth-buttons.tsx+social-login-buttons.tsxcomponents deleted;app/(auth)/callback/{github,apple}/deleted;GITHUB_CLIENT_*/GOOGLE_CLIENT_*/APPLE_CLIENT_IDenv vars + config fields removedmagicLinkplugin removed from server + client;app/(auth)/callback/magic-link/deleted; magic-link UI/hooks removedPASSWORD_LOGIN_ENABLEDtoggle indirection dropped from the UI — password login is now unconditional)Settings
name); a separate editableusernamefield was intentionally not added (scope)i18n (en/zh)
usernamelogin label; removed OAuth/magic-link strings; settings now usesdisplayNameNotes
jwtplugin is kept — it's required for the dashboard→API service JWT and the OAuth token flow for CLI/MCP clientsRESEND_*env vars are kept (still used for password-reset emails)NULLusername; they must update via the profile/DB before logging in by username (new sign-ups are unaffected)pnpm type-check,pnpm test(108 passed),pnpm build