Scheduling infrastructure for absolutely everyone.
chore: change identifier (#18518)
Udit Takkar8a8c8705139b
diff --git a/packages/trpc/server/routers/loggedInViewer/addSecondaryEmail.handler.ts b/packages/trpc/server/routers/loggedInViewer/addSecondaryEmail.handler.tsindex f03b2fc7ce2..6a0218da1f4 100644--- a/packages/trpc/server/routers/loggedInViewer/addSecondaryEmail.handler.ts+++ b/packages/trpc/server/routers/loggedInViewer/addSecondaryEmail.handler.ts@@ -1,6 +1,7 @@import type { GetServerSidePropsContext, NextApiResponse } from "next";import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";+import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";import { prisma } from "@calcom/prisma";import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";@@ -19,6 +20,11 @@ type AddSecondaryEmailOptions = {export const addSecondaryEmailHandler = async ({ ctx, input }: AddSecondaryEmailOptions) => {const { user } = ctx;+ await checkRateLimitAndThrowError({+ rateLimitingType: "core",+ identifier: `addSecondaryEmail.${user.email}`,+ });+const existingPrimaryEmail = await prisma.user.findUnique({where: {email: input.email,diff --git a/packages/trpc/server/routers/viewer/auth/resendVerifyEmail.handler.ts b/packages/trpc/server/routers/viewer/auth/resendVerifyEmail.handler.tsindex bf0a2ed8a17..3c93c687926 100644--- a/packages/trpc/server/routers/viewer/auth/resendVerifyEmail.handler.ts+++ b/packages/trpc/server/routers/viewer/auth/resendVerifyEmail.handler.ts@@ -1,8 +1,5 @@-import type { NextApiRequest } from "next";-import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";-import getIP from "@calcom/lib/getIP";import logger from "@calcom/lib/logger";import { prisma } from "@calcom/prisma";import { TRPCError } from "@calcom/trpc/server";@@ -23,7 +20,7 @@ const log = logger.getSubLogger({ prefix: [`[[Auth] `] });export const resendVerifyEmail = async ({ input, ctx }: ResendEmailOptions) => {let emailToVerify = ctx.user.email;- const identifer = ctx.req ? getIP(ctx.req as NextApiRequest) : emailToVerify;+ const identifer = emailToVerify;await checkRateLimitAndThrowError({rateLimitingType: "core",