[PR #7165] [CLOSED] feat: make username optional #15361

Closed
opened 2026-04-13 09:59:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7165
Author: @himself65
Created: 1/7/2026
Status: Closed

Base: canaryHead: himself65/2026/01/07/optional-username


📝 Commits (1)

  • e4bd021 feat: make username optional

📊 Changes

3 files changed (+91 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/api/routes/sign-up.test.ts (+45 -2)
📝 packages/better-auth/src/api/routes/sign-up.ts (+42 -3)
📝 packages/core/src/types/init-options.ts (+4 -0)

📄 Description


Summary by cubic

Make username optional during email sign-up, controlled by a new user.requireUsername option. Default behavior keeps username required; set requireUsername to false to make it optional.

  • New Features
    • Added user.requireUsername?: boolean to BetterAuthOptions.
    • Updated signUpEmail to accept optional name and infer body types based on config.
    • Added tests to validate type behavior for default, true, and false configurations.

Written for commit e4bd02153c. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7165 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/7/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2026/01/07/optional-username` --- ### 📝 Commits (1) - [`e4bd021`](https://github.com/better-auth/better-auth/commit/e4bd02153c54030ff9e53d91853e1bd254d38437) feat: make username optional ### 📊 Changes **3 files changed** (+91 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/sign-up.test.ts` (+45 -2) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+42 -3) 📝 `packages/core/src/types/init-options.ts` (+4 -0) </details> ### 📄 Description - Closes https://github.com/better-auth/better-auth/issues/424 > - Related to https://github.com/better-auth/better-auth/issues/5139 --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Make username optional during email sign-up, controlled by a new user.requireUsername option. Default behavior keeps username required; set requireUsername to false to make it optional. - **New Features** - Added user.requireUsername?: boolean to BetterAuthOptions. - Updated signUpEmail to accept optional name and infer body types based on config. - Added tests to validate type behavior for default, true, and false configurations. <sup>Written for commit e4bd02153c54030ff9e53d91853e1bd254d38437. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:59:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15361