Skip to content

Commit 1a0bf47

Browse files
authored
fix: verification code perf (#27631)
1 parent 9de621e commit 1a0bf47

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/trpc/server/routers/viewer/workflows/sendVerificationCode.handler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CreditsRepository } from "@calcom/features/credits/repositories/CreditsRepository";
22
import { sendVerificationCode } from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber";
3+
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
34
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
45
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
56

@@ -34,6 +35,11 @@ export const sendVerificationCodeHandler = async ({ ctx, input }: SendVerificati
3435
throw new TRPCError({ code: "UNAUTHORIZED" });
3536
}
3637

38+
await checkRateLimitAndThrowError({
39+
identifier: `sendVerificationCode:${user.id}`,
40+
rateLimitingType: "core",
41+
});
42+
3743
const { phoneNumber } = input;
3844
return sendVerificationCode(phoneNumber);
3945
};

0 commit comments

Comments
 (0)