From 1a0bf47bc56cc5dc90cf49cf96ba83b8cd62d2f3 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Wed, 4 Feb 2026 18:41:41 +0000 Subject: [PATCH] fix: verification code perf (#27631) --- .../viewer/workflows/sendVerificationCode.handler.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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); };