Files
calendar/packages/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler.ts
T
Anik Dhabal BabuandGitHub ee70111c45 fix: RateLimit verify email and fix (#23718)
* fix: RateLimit verify email

* update

* client chnages

* type error

* fix

* add test

* Update event-types.e2e.ts

* minor update

* Update event-types.e2e.ts

* fix test

* handle it in api v2
2025-09-12 18:27:05 +01:00

20 lines
535 B
TypeScript

import type { ZVerifyCodeInputSchema } from "@calcom/prisma/zod-utils";
import { TRPCError } from "@trpc/server";
import { verifyCodeUnAuthenticated } from "./util";
type VerifyTokenOptions = {
input: ZVerifyCodeInputSchema;
};
export const verifyCodeUnAuthenticatedHandler = async ({ input }: VerifyTokenOptions) => {
const { email, code } = input;
try {
await verifyCodeUnAuthenticated(email, code);
return true;
} catch (error) {
throw new TRPCError({ code: "BAD_REQUEST", message: "invalid_code" });
}
};