Skip to content

Scheduling infrastructure for absolutely everyone.

fix: platform library export-verifyEmailCodeUnAuthenticated (#23814)

Benny Jooa7fecaf57851
diff --git a/apps/api/v2/package.json b/apps/api/v2/package.json
index 8414f5aba04..4e7896b91dc 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/[email protected]",
+ "@calcom/platform-libraries": "npm:@calcom/[email protected]",
"@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 fd22c643ade..760cd392f24 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 7a78482bc50..32c04f57eb0 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 0b7be0643ef..453d08bc5fa 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 2cdd0b90f1b..72bc0e82faa 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 d5570aaee6e..1db0bafde66 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/[email protected]"
+ "@calcom/platform-libraries": "npm:@calcom/[email protected]"
"@calcom/platform-types": "*"
"@calcom/platform-utils": "*"
"@calcom/prisma": "*"
@@ -3775,13 +3775,13 @@ __metadata:
languageName: unknown
linkType: soft
-"@calcom/platform-libraries@npm:@calcom/[email protected]":
- version: 0.0.356
- resolution: "@calcom/platform-libraries@npm:0.0.356"
+"@calcom/platform-libraries@npm:@calcom/[email protected]":
+ 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