Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update route.ts

Kiran K27d63beb4816
diff --git a/apps/web/app/api/user/password/route.ts b/apps/web/app/api/user/password/route.ts
index ebaa399fbe..bd69f53f5d 100644
--- a/apps/web/app/api/user/password/route.ts
+++ b/apps/web/app/api/user/password/route.ts
@@ -43,14 +43,22 @@ export const PATCH = withSession(async ({ req, session }) => {
});
}
- await prisma.user.update({
- where: {
- id: session.user.id,
- },
- data: {
- passwordHash: await hashPassword(newPassword),
- },
- });
+ await Promise.all([
+ prisma.user.update({
+ where: {
+ id: session.user.id,
+ },
+ data: {
+ passwordHash: await hashPassword(newPassword),
+ },
+ }),
+
+ prisma.passwordResetToken.deleteMany({
+ where: {
+ identifier: session.user.email,
+ },
+ }),
+ ]);
// Send the email to inform the user that their password has been updated
waitUntil(