mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 01:14:10 +05:30
feat: add email verification and dark mode
This commit is contained in:
@@ -25,11 +25,14 @@ export const authOptions: NextAuthOptions = {
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { email: credentials.email },
|
||||
where: { email: credentials.email.trim().toLowerCase() },
|
||||
});
|
||||
if (!user || user.status !== "ACTIVE") return null;
|
||||
const valid = await bcrypt.compare(credentials.password, user.password);
|
||||
if (!valid) return null;
|
||||
if (config?.emailVerificationRequired && user.role !== "ADMIN" && !user.emailVerifiedAt) {
|
||||
throw new Error("EMAIL_NOT_VERIFIED");
|
||||
}
|
||||
return { id: user.id, email: user.email, name: user.name, role: user.role };
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user