diff --git a/packages/trpc/server/routers/viewer/workflows/sendVerificationCode.handler.ts b/packages/trpc/server/routers/viewer/workflows/sendVerificationCode.handler.ts index f5a2826510..0badf1c057 100644 --- a/packages/trpc/server/routers/viewer/workflows/sendVerificationCode.handler.ts +++ b/packages/trpc/server/routers/viewer/workflows/sendVerificationCode.handler.ts @@ -1,5 +1,6 @@ import { CreditsRepository } from "@calcom/features/credits/repositories/CreditsRepository"; import { sendVerificationCode } from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber"; +import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError"; import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata"; import type { TrpcSessionUser } from "@calcom/trpc/server/types"; @@ -34,6 +35,11 @@ export const sendVerificationCodeHandler = async ({ ctx, input }: SendVerificati throw new TRPCError({ code: "UNAUTHORIZED" }); } + await checkRateLimitAndThrowError({ + identifier: `sendVerificationCode:${user.id}`, + rateLimitingType: "core", + }); + const { phoneNumber } = input; return sendVerificationCode(phoneNumber); };