Scheduling infrastructure for absolutely everyone.
fix: delete use when 2fa is disabled (#5899)
Udit Takkar7501635fbf78
diff --git a/packages/trpc/server/routers/viewer.tsx b/packages/trpc/server/routers/viewer.tsxindex ebcf6e2519e..42b6488fc0b 100644--- a/packages/trpc/server/routers/viewer.tsx+++ b/packages/trpc/server/routers/viewer.tsx@@ -230,26 +230,24 @@ const loggedInViewerRouter = router({throw new Error(ErrorCode.InternalServerError);}+ // If user has 2fa enabled, check if input.totpCode is correctconst isValidToken = authenticator.check(input.totpCode, secret);if (!isValidToken) {throw new Error(ErrorCode.IncorrectTwoFactorCode);}- // If user has 2fa enabled, check if input.totpCode is correct- // If it is, delete the user from stripe and database-- // Remove me from Stripe- await deleteStripeCustomer(user).catch(console.warn);-- // Remove my account- const deletedUser = await ctx.prisma.user.delete({- where: {- id: ctx.user.id,- },- });- // Sync Services- syncServicesDeleteWebUser(deletedUser);}+ // If 2FA is disabled or totpCode is valid then delete the user from stripe and database+ await deleteStripeCustomer(user).catch(console.warn);+ // Remove my account+ const deletedUser = await ctx.prisma.user.delete({+ where: {+ id: ctx.user.id,+ },+ });++ // Sync Services+ syncServicesDeleteWebUser(deletedUser);return;}),deleteMeWithoutPassword: authedProcedure.mutation(async ({ ctx }) => {