The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Restrict if email not verified
Kiran K6de67f9a762e
diff --git a/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx b/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsxindex 4b938bc101..508bfb5e08 100644--- a/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx+++ b/apps/web/app/app.dub.co/(auth)/login/signin-email-password.tsx@@ -21,6 +21,7 @@ const errorCodes = {"exceeded-login-attempts":"Account has been locked due to too many login attempts. Please contact support to unlock your account.","too-many-login-attempts": "Too many login attempts. Please try again later.",+ "email-not-verified": "Please verify your email to sign in.",};export const SignInWithEmailPassword = () => {diff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.tsindex b4b7f1d65d..8230c25524 100644--- a/apps/web/lib/auth/options.ts+++ b/apps/web/lib/auth/options.ts@@ -209,6 +209,7 @@ export const authOptions: NextAuthOptions = {email: true,image: true,invalidLoginAttempts: true,+ emailVerified: true,},});@@ -216,6 +217,10 @@ export const authOptions: NextAuthOptions = {throw new Error("invalid-credentials");}+ if (!user.emailVerified) {+ throw new Error("email-not-verified");+ }+if (exceededLoginAttemptsThreshold(user)) {throw new Error("exceeded-login-attempts");}