Scheduling infrastructure for absolutely everyone.
chore: Skipping totp code for org dev (#10403)
Leo Giovanettidae4627ada54
diff --git a/packages/lib/constants.ts b/packages/lib/constants.tsindex 7b8ea383cd0..d7f436b276e 100644--- a/packages/lib/constants.ts+++ b/packages/lib/constants.ts@@ -34,10 +34,12 @@ export const IS_CALCOM =WEBAPP_URL &&(new URL(WEBAPP_URL).hostname.endsWith("cal.com") ||new URL(WEBAPP_URL).hostname.endsWith("cal.dev") ||+ new URL(WEBAPP_URL).hostname.endsWith("cal.qa") ||new URL(WEBAPP_URL).hostname.endsWith("cal-staging.com"));export const CONSOLE_URL =new URL(WEBAPP_URL).hostname.endsWith(".cal.dev") ||+ new URL(WEBAPP_URL).hostname.endsWith(".cal.qa") ||new URL(WEBAPP_URL).hostname.endsWith(".cal-staging.com") ||process.env.NODE_ENV !== "production"? `https://console.cal.dev`diff --git a/packages/trpc/server/routers/viewer/organizations/create.handler.ts b/packages/trpc/server/routers/viewer/organizations/create.handler.tsindex b2f5124e787..78a7457a450 100644--- a/packages/trpc/server/routers/viewer/organizations/create.handler.ts+++ b/packages/trpc/server/routers/viewer/organizations/create.handler.ts@@ -5,7 +5,7 @@ import { sendOrganizationEmailVerification } from "@calcom/emails";import { hashPassword } from "@calcom/features/auth/lib/hashPassword";import { subdomainSuffix } from "@calcom/features/ee/organizations/lib/orgDomains";import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/availability";-import { IS_PRODUCTION, IS_TEAM_BILLING_ENABLED, RESERVED_SUBDOMAINS } from "@calcom/lib/constants";+import { IS_CALCOM, IS_TEAM_BILLING_ENABLED, RESERVED_SUBDOMAINS } from "@calcom/lib/constants";import { getTranslation } from "@calcom/lib/server/i18n";import { prisma } from "@calcom/prisma";import { MembershipRole } from "@calcom/prisma/enums";@@ -82,6 +82,8 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {const availability = getAvailabilityFromSchedule(DEFAULT_SCHEDULE);if (check === false) {+ if (IS_CALCOM) await vercelCreateDomain(slug);+const createOwnerOrg = await prisma.user.create({data: {username: adminUsername,@@ -118,8 +120,6 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {},});- if (IS_PRODUCTION) await vercelCreateDomain(slug);-await prisma.membership.create({data: {userId: createOwnerOrg.id,diff --git a/packages/trpc/server/routers/viewer/organizations/verifyCode.handler.ts b/packages/trpc/server/routers/viewer/organizations/verifyCode.handler.tsindex 06725231595..2b5af78dae9 100644--- a/packages/trpc/server/routers/viewer/organizations/verifyCode.handler.ts+++ b/packages/trpc/server/routers/viewer/organizations/verifyCode.handler.ts@@ -1,6 +1,7 @@import { createHash } from "crypto";import { totp } from "otplib";+import { IS_PRODUCTION } from "@calcom/lib/constants";import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";import { TRPCError } from "@trpc/server";@@ -20,6 +21,8 @@ export const verifyCodeHandler = async ({ ctx, input }: VerifyCodeOptions) => {if (!user || !email || !code) throw new TRPCError({ code: "BAD_REQUEST" });+ if (!IS_PRODUCTION) return true;+const secret = createHash("md5").update(email + process.env.CALENDSO_ENCRYPTION_KEY).digest("hex");