[PR #6175] [MERGED] fix(magic-link): ensure emailVerified update is reflected in user object #6501

Closed
opened 2026-03-13 13:01:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6175
Author: @bytaesu
Created: 11/21/2025
Status: Merged
Merged: 11/21/2025
Merged by: @Bekacru

Base: canaryHead: 2025-11-22/fix/magic-link-update-user


📝 Commits (7)

  • cfef2fd fix: correct return type
  • 3b744e9 fix(magic-link): ensure emailVerified update is reflected in user object
  • d9cb475 test: add test case for emailVerified
  • 270612e fix: lint
  • f35617b fix: generic in update user functions
  • 8648a3c fix: use generic to resolve type error
  • 150f4ca Merge branch 'canary' into 2025-11-22/fix/magic-link-update-user

📊 Changes

4 files changed (+98 additions, -16 deletions)

View changed files

📝 packages/better-auth/src/plugins/magic-link/index.ts (+1 -1)
📝 packages/better-auth/src/plugins/magic-link/magic-link.test.ts (+77 -0)
📝 packages/better-auth/src/plugins/phone-number/index.ts (+15 -10)
📝 packages/core/src/types/context.ts (+5 -5)

📄 Description

Closes https://github.com/better-auth/better-auth/issues/6158


Summary by cubic

Fixes magic link verification so emailVerified updates are immediately reflected in the returned user and session. Also ensures phone number verification returns the updated user.

  • Bug Fixes
    • Assign updateUser result to user during magic link verification so emailVerified: true is included in the response and session.
    • Use generic updateUser in phone number flows and assign the result, so phoneNumber and phoneNumberVerified are reflected in responses.
    • Make InternalAdapter updateUser/updateUserByEmail return User & T (generic) to support plugin fields.
    • Add test verifying response, session, and DB show emailVerified: true after verification.

Written for commit 150f4caea7. Summary will update automatically 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/6175 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 11/21/2025 **Status:** ✅ Merged **Merged:** 11/21/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2025-11-22/fix/magic-link-update-user` --- ### 📝 Commits (7) - [`cfef2fd`](https://github.com/better-auth/better-auth/commit/cfef2fd575a5f755c670f0371f4329bed16834c5) fix: correct return type - [`3b744e9`](https://github.com/better-auth/better-auth/commit/3b744e9e090067f803be2e79084cb0a35e1e98b0) fix(magic-link): ensure emailVerified update is reflected in user object - [`d9cb475`](https://github.com/better-auth/better-auth/commit/d9cb475fa32e530c2d88ebdae08f7912b583360e) test: add test case for emailVerified - [`270612e`](https://github.com/better-auth/better-auth/commit/270612ef3fb443072f59502a769a8f183cc004f4) fix: lint - [`f35617b`](https://github.com/better-auth/better-auth/commit/f35617b45d7aedebf3b30f96646a2922d916cadc) fix: generic in update user functions - [`8648a3c`](https://github.com/better-auth/better-auth/commit/8648a3c01c17259815e82bd50e647751083fc53b) fix: use generic to resolve type error - [`150f4ca`](https://github.com/better-auth/better-auth/commit/150f4caea7f8a21214f9ea702fad30758e37c4b3) Merge branch 'canary' into 2025-11-22/fix/magic-link-update-user ### 📊 Changes **4 files changed** (+98 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/magic-link/magic-link.test.ts` (+77 -0) 📝 `packages/better-auth/src/plugins/phone-number/index.ts` (+15 -10) 📝 `packages/core/src/types/context.ts` (+5 -5) </details> ### 📄 Description Closes https://github.com/better-auth/better-auth/issues/6158 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes magic link verification so emailVerified updates are immediately reflected in the returned user and session. Also ensures phone number verification returns the updated user. - **Bug Fixes** - Assign updateUser result to user during magic link verification so emailVerified: true is included in the response and session. - Use generic updateUser in phone number flows and assign the result, so phoneNumber and phoneNumberVerified are reflected in responses. - Make InternalAdapter updateUser/updateUserByEmail return User & T (generic) to support plugin fields. - Add test verifying response, session, and DB show emailVerified: true after verification. <sup>Written for commit 150f4caea7f8a21214f9ea702fad30758e37c4b3. Summary will update automatically 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-03-13 13:01:22 -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#6501