From a7fecaf578514d228082026d02f440ad11211291 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Sat, 13 Sep 2025 07:16:04 -0400 Subject: [PATCH] fix: platform library export-verifyEmailCodeUnAuthenticated (#23814) * fix apiv2 * fix import --- apps/api/v2/package.json | 2 +- .../atoms/services/verification-atom.service.ts | 2 +- packages/platform/libraries/index.ts | 2 +- packages/trpc/server/routers/viewer/auth/util.ts | 2 +- .../viewer/auth/verifyCodeUnAuthenticated.handler.ts | 3 +-- yarn.lock | 10 +++++----- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/api/v2/package.json b/apps/api/v2/package.json index 8414f5aba0..4e7896b91d 100644 --- a/apps/api/v2/package.json +++ b/apps/api/v2/package.json @@ -38,7 +38,7 @@ "@axiomhq/winston": "^1.2.0", "@calcom/platform-constants": "*", "@calcom/platform-enums": "*", - "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.356", + "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.358", "@calcom/platform-types": "*", "@calcom/platform-utils": "*", "@calcom/prisma": "*", diff --git a/apps/api/v2/src/modules/atoms/services/verification-atom.service.ts b/apps/api/v2/src/modules/atoms/services/verification-atom.service.ts index fd22c643ad..760cd392f2 100644 --- a/apps/api/v2/src/modules/atoms/services/verification-atom.service.ts +++ b/apps/api/v2/src/modules/atoms/services/verification-atom.service.ts @@ -27,7 +27,7 @@ export class VerificationAtomsService { async verifyEmailCodeUnAuthenticated(input: VerifyEmailCodeInput) { try { - return await verifyCodeUnAuthenticated(input); + return await verifyCodeUnAuthenticated(input.email, input.code); } catch (error) { if (error instanceof Error) { if (error.message === "invalid_code") { diff --git a/packages/platform/libraries/index.ts b/packages/platform/libraries/index.ts index 7a78482bc5..32c04f57eb 100644 --- a/packages/platform/libraries/index.ts +++ b/packages/platform/libraries/index.ts @@ -128,7 +128,7 @@ export { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner"; export { verifyPhoneNumber, sendVerificationCode }; -export { verifyCodeUnAuthenticated } from "@calcom/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler"; +export { verifyCodeUnAuthenticated } from "@calcom/trpc/server/routers/viewer/auth/util"; export { verifyCode as verifyCodeAuthenticated } from "@calcom/trpc/server/routers/viewer/organizations/verifyCode.handler"; diff --git a/packages/trpc/server/routers/viewer/auth/util.ts b/packages/trpc/server/routers/viewer/auth/util.ts index 0b7be0643e..453d08bc5f 100644 --- a/packages/trpc/server/routers/viewer/auth/util.ts +++ b/packages/trpc/server/routers/viewer/auth/util.ts @@ -24,5 +24,5 @@ export const verifyCodeUnAuthenticated = async (email: string, code: string) => throw new Error("Invalid verification code"); } - return; + return true; }; diff --git a/packages/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler.ts b/packages/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler.ts index 2cdd0b90f1..72bc0e82fa 100644 --- a/packages/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler.ts +++ b/packages/trpc/server/routers/viewer/auth/verifyCodeUnAuthenticated.handler.ts @@ -11,8 +11,7 @@ type VerifyTokenOptions = { export const verifyCodeUnAuthenticatedHandler = async ({ input }: VerifyTokenOptions) => { const { email, code } = input; try { - await verifyCodeUnAuthenticated(email, code); - return true; + return await verifyCodeUnAuthenticated(email, code); } catch (error) { throw new TRPCError({ code: "BAD_REQUEST", message: "invalid_code" }); } diff --git a/yarn.lock b/yarn.lock index d5570aaee6..1db0bafde6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2715,7 +2715,7 @@ __metadata: "@axiomhq/winston": ^1.2.0 "@calcom/platform-constants": "*" "@calcom/platform-enums": "*" - "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.356" + "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.358" "@calcom/platform-types": "*" "@calcom/platform-utils": "*" "@calcom/prisma": "*" @@ -3775,13 +3775,13 @@ __metadata: languageName: unknown linkType: soft -"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.356": - version: 0.0.356 - resolution: "@calcom/platform-libraries@npm:0.0.356" +"@calcom/platform-libraries@npm:@calcom/platform-libraries@0.0.358": + version: 0.0.358 + resolution: "@calcom/platform-libraries@npm:0.0.358" dependencies: "@calcom/features": "*" "@calcom/lib": "*" - checksum: dabce8a4add6c8082f06168ce9fbfef9be258f8ac3c60cb81e1985b4b49e2503f0f539dda9faf371bd1c79133419aed36d0ff849b6a2ecca77e7854752d8c97d + checksum: 2a3436a24c62c38aa1299237cc2c650826a3cfc9cbffa5cc2f37244abed13dc0f55dbd314037e16af3168b9e7bfa4b62abf20aee00654e8aa24ab4bc7e76c642 languageName: node linkType: hard