Skip to content

Commit

Permalink
restore token deletion if successful auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Soxasora committed Jan 16, 2025
1 parent 5362dde commit 6133e7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6133e7a

Please sign in to comment.