From 6133e7a7f98acbf44d6d7a5f0d87bea4f31a3761 Mon Sep 17 00:00:00 2001 From: Soxasora Date: Thu, 16 Jan 2025 14:20:43 +0100 Subject: [PATCH] restore token deletion if successful auth --- pages/api/auth/[...nextauth].js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index 2af335869..075a8d68a 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -337,7 +337,10 @@ export const getAuthOptions = (req, res) => ({ }) if (verificationRequest) { - if (verificationRequest.token === token) { // continue if correct + if (verificationRequest.token === token) { // if correct delete the token and continue + await prisma.verificationToken.delete({ + where: { id: verificationRequest.id } + }) return verificationRequest } else { // increment attempts if incorrect const newAttempts = verificationRequest.attempts + 1