[PR #3499] [CLOSED] fix(sign-up): set emailVerified to null against false (#3469) #21759

Closed
opened 2026-04-15 20:34:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3499
Author: @mriusero
Created: 7/20/2025
Status: Closed

Base: mainHead: fix/emailVerified-null-signup


📝 Commits (3)

  • cde7455 fix(sign-up): set emailVerified to null
  • b456420 fix: change emailVerified type to nullable date
  • 34fea6b style: format OpenAPI and schema for emailVerified

📊 Changes

4 files changed (+7 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/api/routes/email-verification.ts (+4 -2)
📝 packages/better-auth/src/api/routes/sign-up.ts (+1 -1)
📝 packages/better-auth/src/db/internal-adapter.ts (+1 -1)
📝 packages/better-auth/src/db/schema.ts (+1 -1)

📄 Description

Description

This PR fixes a bug where the emailVerified field was set to false during user signup, which is incompatible with Prisma when the field is defined as DateTime?. Prisma expects either a valid date or null, not a boolean.

Now, on signup, emailVerified is set to null if the email is not verified, ensuring compatibility with the Prisma schema.

Closes #3469

Changes

  • Updated /packages/better-auth/src/api/routes/sign-up.ts to set emailVerified: null on user creation.
  • Updated /packages/better-auth/src/db/internal-adapter.ts to set emailVerified: null on user creation.

Check

  • Should not cause regression in packages/better-auth/src/api/routes/email-verification.ts :
if (session?.user.emailVerified) {
	throw new APIError("BAD_REQUEST", {
		message:
			"You can only send a verification email to an unverified email",
	});
}

This PR ensures that theemailVerified field is always compatible with the Prisma schema, preventing type errors on user creation and maintaining correct email verification logic.


Summary by cubic

Fixed a bug where the emailVerified field was set to false on signup, causing type errors with Prisma. Now, emailVerified is set to null for new users to match the Prisma schema.


🔄 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/3499 **Author:** [@mriusero](https://github.com/mriusero) **Created:** 7/20/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/emailVerified-null-signup` --- ### 📝 Commits (3) - [`cde7455`](https://github.com/better-auth/better-auth/commit/cde7455005a52a965e7701b5b23db0fbe655a0a5) fix(sign-up): set emailVerified to null - [`b456420`](https://github.com/better-auth/better-auth/commit/b456420fc6c2d77864917e3a8ae666cc600e7b19) fix: change emailVerified type to nullable date - [`34fea6b`](https://github.com/better-auth/better-auth/commit/34fea6bc7d33d22d137d63bc6eb155bdad9e4daa) style: format OpenAPI and schema for emailVerified ### 📊 Changes **4 files changed** (+7 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/email-verification.ts` (+4 -2) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+1 -1) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+1 -1) 📝 `packages/better-auth/src/db/schema.ts` (+1 -1) </details> ### 📄 Description ## Description This PR fixes a bug where the `emailVerified` field was set to `false` during user signup, which is incompatible with Prisma when the field is defined as `DateTime?`. Prisma expects either a valid date or `null`, not a boolean. Now, on signup, `emailVerified` is set to `null` if the email is not verified, ensuring compatibility with the Prisma schema. ## Related Issue Closes #3469 ## Changes - Updated `/packages/better-auth/src/api/routes/sign-up.ts` to set `emailVerified: null` on user creation. - Updated `/packages/better-auth/src/db/internal-adapter.ts` to set `emailVerified: null` on user creation. ## Check - Should not cause regression in `packages/better-auth/src/api/routes/email-verification.ts` : ```js if (session?.user.emailVerified) { throw new APIError("BAD_REQUEST", { message: "You can only send a verification email to an unverified email", }); } ``` This PR ensures that the`emailVerified` field is always compatible with the Prisma schema, preventing type errors on user creation and maintaining correct email verification logic. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed a bug where the emailVerified field was set to false on signup, causing type errors with Prisma. Now, emailVerified is set to null for new users to match the Prisma schema. <!-- 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-15 20:34:51 -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#21759