[PR #5140] [CLOSED] feat(magic-link): require name for signup #14052

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5140
Author: @ouariachi
Created: 10/7/2025
Status: Closed

Base: canaryHead: feat/magic-link-require-name-for-signup


📝 Commits (10+)

  • 26c9e18 feat(magic-link): require name for new users on signup
  • 5694861 docs: add requireNameForSignUp option explanation
  • b6c1dd2 Merge branch 'canary' into feat/magic-link-require-name-for-signup
  • 3a34fb4 fix(magic-link): make the error code lowercase to keep consistency with others
  • 45a1f36 Merge branch 'feat/magic-link-require-name-for-signup' of https://github.com/ouariachi/better-auth into feat/magic-link-require-name-for-signup
  • fc2fdb8 Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup
  • eb868a3 Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup
  • 4f26126 Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup
  • 285b81e test(magic-link): fix requireNameForSignUp test
  • a17f075 chore(refactor): format magic-link test

📊 Changes

3 files changed (+76 additions, -0 deletions)

View changed files

📝 docs/content/docs/plugins/magic-link.mdx (+2 -0)
📝 packages/better-auth/src/plugins/magic-link/index.ts (+23 -0)
📝 packages/better-auth/src/plugins/magic-link/magic-link.test.ts (+51 -0)

📄 Description

What changes were made and why:

  • Added a new configuration option requireNameForSignUp in the Magic Link plugin.
  • When enabled, any attempt to create a new user via Magic Link without a non-empty name field will fail.
  • This ensures new users always have a name, improving data consistency and preventing incomplete user records.
  • Updated the plugin documentation to include the new requireNameForSignUp option and describe its behavior.

Relevant context:

  • Currently, Magic Link signup allows creating users without a name.
  • The recommended workaround (from issue comment) was to collect name later, but adding native support avoids extra steps and simplifies the flow.

Breaking changes / deprecations:

  • No breaking changes.
  • Flows without requireNameForSignUp enabled remain unchanged.

Tests / screenshots:

  • Added test to verify that signup fails if name is missing when requireNameForSignUp is true.

Related issues / discussions:


Summary by cubic

Added an option to require a non-empty name when creating new users via Magic Link signup. This prevents nameless accounts and improves data consistency.

  • New Features
    • Added requireNameForSignUp (default: false).
    • When enabled (and sign up isn’t disabled), new user signup without a non-empty name redirects with ?error=NAME_REQUIRED_FOR_SIGNUP.
    • Updated docs to cover the new option.

🔄 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/5140 **Author:** [@ouariachi](https://github.com/ouariachi) **Created:** 10/7/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/magic-link-require-name-for-signup` --- ### 📝 Commits (10+) - [`26c9e18`](https://github.com/better-auth/better-auth/commit/26c9e18a9a593dc999638fdd5fa4b068592f2e79) feat(magic-link): require name for new users on signup - [`5694861`](https://github.com/better-auth/better-auth/commit/5694861c8ef0ff58d831ea894bd833c563bc963e) docs: add requireNameForSignUp option explanation - [`b6c1dd2`](https://github.com/better-auth/better-auth/commit/b6c1dd298c0b458b573966a9113fed4e51318c07) Merge branch 'canary' into feat/magic-link-require-name-for-signup - [`3a34fb4`](https://github.com/better-auth/better-auth/commit/3a34fb478aeeec96c9583d8ffa043b774b991b42) fix(magic-link): make the error code lowercase to keep consistency with others - [`45a1f36`](https://github.com/better-auth/better-auth/commit/45a1f361710b4e85aab3a3dfc5c09e0afcf2b85d) Merge branch 'feat/magic-link-require-name-for-signup' of https://github.com/ouariachi/better-auth into feat/magic-link-require-name-for-signup - [`fc2fdb8`](https://github.com/better-auth/better-auth/commit/fc2fdb8e7b8b8611a3925a2473fa40876ee96e07) Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup - [`eb868a3`](https://github.com/better-auth/better-auth/commit/eb868a3b2c4ad4deaac26f57846cf89e4bf646c5) Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup - [`4f26126`](https://github.com/better-auth/better-auth/commit/4f261267ecb010f8b0461a5ab0349bcc8f2241d2) Merge branch 'better-auth:canary' into feat/magic-link-require-name-for-signup - [`285b81e`](https://github.com/better-auth/better-auth/commit/285b81eb143dd23a37259f732e9d430fbb4cdb73) test(magic-link): fix requireNameForSignUp test - [`a17f075`](https://github.com/better-auth/better-auth/commit/a17f0754af918c2f6a7ddea9564eab8c0bf3dd7d) chore(refactor): format magic-link test ### 📊 Changes **3 files changed** (+76 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/magic-link.mdx` (+2 -0) 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+23 -0) 📝 `packages/better-auth/src/plugins/magic-link/magic-link.test.ts` (+51 -0) </details> ### 📄 Description **What changes were made and why:** * Added a new configuration option `requireNameForSignUp` in the Magic Link plugin. * When enabled, any attempt to create a new user via Magic Link without a non-empty `name` field will fail. * This ensures new users always have a `name`, improving data consistency and preventing incomplete user records. * Updated the plugin documentation to include the new requireNameForSignUp option and describe its behavior. **Relevant context:** * Currently, Magic Link signup allows creating users without a name. * The recommended workaround (from [issue comment](https://github.com/better-auth/better-auth/issues/4728#issuecomment-3304537808)) was to collect `name` later, but adding native support avoids extra steps and simplifies the flow. **Breaking changes / deprecations:** * No breaking changes. * Flows without `requireNameForSignUp` enabled remain unchanged. **Tests / screenshots:** * Added test to verify that signup fails if `name` is missing when `requireNameForSignUp` is true. **Related issues / discussions:** * Closes #5139 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added an option to require a non-empty name when creating new users via Magic Link signup. This prevents nameless accounts and improves data consistency. - **New Features** - Added requireNameForSignUp (default: false). - When enabled (and sign up isn’t disabled), new user signup without a non-empty name redirects with ?error=NAME_REQUIRED_FOR_SIGNUP. - Updated docs to cover the new option. <!-- 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:17:25 -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#14052