The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
chore: Unlock account after successful password reset and reset invalid login attempts
Kiran Kf44563880396
diff --git a/apps/web/app/api/auth/reset-password/route.ts b/apps/web/app/api/auth/reset-password/route.tsindex dd17ff5f1f..eac2fa1f63 100644--- a/apps/web/app/api/auth/reset-password/route.ts+++ b/apps/web/app/api/auth/reset-password/route.ts@@ -54,7 +54,7 @@ export async function POST(req: NextRequest) {},data: {passwordHash: await hashPassword(password),- emailVerified: new Date(),+ lockedAt: null, // Unlock the account after a successful password reset},}),]);diff --git a/apps/web/lib/auth/lock-account.ts b/apps/web/lib/auth/lock-account.tsindex 131edc1541..6db4d1d9c6 100644--- a/apps/web/lib/auth/lock-account.ts+++ b/apps/web/lib/auth/lock-account.ts@@ -36,15 +36,6 @@ export const incrementLoginAttempts = async (};};-export const resetLoginAttempts = async (userId: string) => {- await prisma.user.update({- where: { id: userId },- data: {- invalidLoginAttempts: 0,- },- });-};-export const exceededLoginAttemptsThreshold = (user: Pick<User, "invalidLoginAttempts">,) => {diff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.tsindex 37ccb9bd27..e652359595 100644--- a/apps/web/lib/auth/options.ts+++ b/apps/web/lib/auth/options.ts@@ -20,7 +20,6 @@ import { UserProps } from "../types";import {exceededLoginAttemptsThreshold,incrementLoginAttempts,- resetLoginAttempts,} from "./lock-account";import { validatePassword } from "./password";@@ -229,7 +228,13 @@ export const authOptions: NextAuthOptions = {}}- await resetLoginAttempts(user.id);+ // Reset invalid login attempts+ await prisma.user.update({+ where: { id: user.id },+ data: {+ invalidLoginAttempts: 0,+ },+ });return {id: user.id,