fix: verification code perf (#27631)
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user