fix: case-insensitive email matching in auth and password reset
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m10s

Email lookups used findUnique (case-sensitive on PostgreSQL) but user
input was lowercased, causing login failures for users with mixed-case
emails stored in the DB (e.g. Laurent_Faure@dietsmann.com). Also
normalized 7 affected emails to lowercase on the production DB.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-04-14 11:04:31 -04:00
parent ec69706bc7
commit eb1e8a7870
3 changed files with 29 additions and 27 deletions

View File

@@ -24,8 +24,8 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ exists: false }, { status: 400 })
}
const user = await prisma.user.findUnique({
where: { email: email.toLowerCase().trim() },
const user = await prisma.user.findFirst({
where: { email: { equals: email.toLowerCase().trim(), mode: 'insensitive' } },
select: { status: true },
})