Skip to content

Commit

Permalink
Handle case sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella committed Feb 6, 2025
1 parent 82a5fbb commit 4d47faa
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions apps/web/src/app/[locale]/(auth)/login/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ import { prisma } from "@rallly/database";
import { cookies } from "next/headers";

export async function setVerificationEmail(email: string) {
const count = await prisma.user.count({
const user = await prisma.user.findUnique({
where: {
email,
},
select: {
email: true,
},
});

cookies().set("verification-email", email, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
sameSite: "lax",
maxAge: 15 * 60,
});
if (user) {
cookies().set("verification-email", user.email, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
sameSite: "lax",
maxAge: 15 * 60,
});
return true;
}

return count > 0;
return false;
}

0 comments on commit 4d47faa

Please sign in to comment.