Skip to content

fix(auth): set emailVerified in OIDC profile and brand login title - #21

Merged
JOY (JOY) merged 1 commit into
mainfrom
dev
Aug 23, 2026
Merged

fix(auth): set emailVerified in OIDC profile and brand login title#21
JOY (JOY) merged 1 commit into
mainfrom
dev

Conversation

@JOY

@JOY JOY (JOY) commented Aug 23, 2026

Copy link
Copy Markdown

Summary

  • Add emailVerified: profile.email_verified ?? true to OIDC profile callback in
    ext-auth-options.ts.
  • Replace hardcoded Cal.diy with NEXT_PUBLIC_APP_NAME || "Crove" in login-view.tsx.

Test plan

  • Tested with NextAuth email verification check on OAuth callback.

Note

Medium Risk
Touches OIDC sign-in by treating missing email_verified as verified, which can affect login gating and identity auto-merge. Branding change is low risk.

Overview
Passes emailVerified from the DOS ID OIDC profile into NextAuth (profile.email_verified ?? true) so the sign-in callback can treat the IdP email as verified instead of failing when the claim is missing.

Also replaces the hardcoded login heading Cal.diy with NEXT_PUBLIC_APP_NAME (fallback Crove).

Reviewed by Cursor Bugbot for commit b84ca0d. Bugbot is set up for automated code reviews on this repo. Configure here.

…ame in login title

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

Welcome to Cal.diy, JOY (@JOY)! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@cursor

cursor Bot commented Aug 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_e109250a-3b8f-469c-9204-7be88ec854c9)

@JOY
JOY (JOY) merged commit ad504c2 into main Aug 23, 2026
10 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the hardcoded application name in the login view with an environment variable and maps the OIDC provider's email verification status. However, a critical type mismatch was identified where a boolean is assigned to the emailVerified field instead of a Date or null, which will cause Prisma database validation errors during login.

id: profile.sub,
name: profile.name || profile.email?.split("@")[0] || "User",
email: profile.email,
emailVerified: profile.email_verified ?? true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Critical Type Mismatch Bug

In the Prisma schema, the emailVerified field on the User model is defined as a DateTime? (timestamp), which maps to a Date | null type in TypeScript:

model User {
  ...
  emailVerified       DateTime?
}

By setting emailVerified: profile.email_verified ?? true, you are passing a boolean (true or false) to this field. When NextAuth attempts to create or update the user in the database via the Prisma adapter, Prisma will throw a validation/runtime error because it cannot write a boolean value to a DateTime column. This will completely break the OIDC login flow for new users.

To fix this, you should map the boolean verification status to a Date object (e.g., new Date()) if verified, or null if not verified.

Suggested change
emailVerified: profile.email_verified ?? true,
emailVerified: (profile.email_verified ?? true) ? new Date() : null,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant