[PR #5699] [MERGED] fix: delete duplicate email existence check in changeEmail endpoint #31765

Closed
opened 2026-04-17 22:39:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5699
Author: @DevDuki
Created: 10/31/2025
Status: Merged
Merged: 10/31/2025
Merged by: @himself65

Base: canaryHead: fix/duplicate-email-existance-check-in-change-email


📝 Commits (1)

  • 4ccfc1f fix: delete duplicate email existence check in changeEmail endpoint and use BASE_ERROR_CODES

📊 Changes

1 file changed (+2 additions, -9 deletions)

View changed files

📝 packages/better-auth/src/api/routes/update-user.ts (+2 -9)

📄 Description

Just noticed this while skimming through the code, so I thought I might as well fix this and open a PR


Summary by cubic

Removed the duplicate email existence check in the changeEmail endpoint and standardized the error response. This reduces unnecessary DB calls and returns 422 UNPROCESSABLE_ENTITY with BASE_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL when the email is already taken.

Written for commit 4ccfc1f0a0. 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/5699 **Author:** [@DevDuki](https://github.com/DevDuki) **Created:** 10/31/2025 **Status:** ✅ Merged **Merged:** 10/31/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/duplicate-email-existance-check-in-change-email` --- ### 📝 Commits (1) - [`4ccfc1f`](https://github.com/better-auth/better-auth/commit/4ccfc1f0a0418ac26d358a3694f121d3aab36084) fix: delete duplicate email existence check in changeEmail endpoint and use BASE_ERROR_CODES ### 📊 Changes **1 file changed** (+2 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/update-user.ts` (+2 -9) </details> ### 📄 Description Just noticed this while skimming through the code, so I thought I might as well fix this and open a PR <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removed the duplicate email existence check in the changeEmail endpoint and standardized the error response. This reduces unnecessary DB calls and returns 422 UNPROCESSABLE_ENTITY with BASE_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL when the email is already taken. <sup>Written for commit 4ccfc1f0a0418ac26d358a3694f121d3aab36084. 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-04-17 22:39:00 -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#31765