feat(auth): implement email verification process with resend functionality and update registration flow

This commit is contained in:
Yusuf İpek
2026-04-11 00:17:09 +03:00
parent 5bff32fef1
commit faa902a604
9 changed files with 403 additions and 3 deletions
+6
View File
@@ -8,6 +8,7 @@ import { db } from '@/lib/db';
import { ProjectMemberRole, WorkspaceMemberRole } from '@prisma/client';
import { hasBillingAccess } from '@/lib/billing';
import { isInviteCodeRequired } from '@/lib/feature-flags';
import { isEmailVerificationEnabled } from '@/lib/email-verification';
// Dummy hash for timing-safe comparison when user doesn't exist
// This prevents user enumeration via timing attacks
@@ -47,6 +48,11 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
return null;
}
// Block sign-in when email verification is required but not yet completed
if (isEmailVerificationEnabled() && !user.emailVerified) {
return null;
}
return {
id: user.id,
name: user.name,