fix: verification code perf (#27631)
This commit is contained in:
1 parent
9de621eb23
commit
1a0bf47bc5
1 file changed
+6
@@ -1,5 +1,6 @@
|
|||||||
import { CreditsRepository } from "@calcom/features/credits/repositories/CreditsRepository";
|
import { CreditsRepository } from "@calcom/features/credits/repositories/CreditsRepository";
|
||||||
import { sendVerificationCode } from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber";
|
import { sendVerificationCode } from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber";
|
||||||
|
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
|
||||||
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
|
||||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||||
|
|
||||||
@@ -34,6 +35,11 @@ export const sendVerificationCodeHandler = async ({ ctx, input }: SendVerificati
|
|||||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await checkRateLimitAndThrowError({
|
||||||
|
identifier: `sendVerificationCode:${user.id}`,
|
||||||
|
rateLimitingType: "core",
|
||||||
|
});
|
||||||
|
|
||||||
const { phoneNumber } = input;
|
const { phoneNumber } = input;
|
||||||
return sendVerificationCode(phoneNumber);
|
return sendVerificationCode(phoneNumber);
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user