Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: set companyId session cookie when an invite is accepted
Brad Barbind7ea1b6e667a
diff --git a/apps/erp/app/routes/_public+/invite.$code.tsx b/apps/erp/app/routes/_public+/invite.$code.tsxindex b6bc6f1c5e..25ce9f3e95 100644--- a/apps/erp/app/routes/_public+/invite.$code.tsx+++ b/apps/erp/app/routes/_public+/invite.$code.tsx@@ -5,7 +5,12 @@ import {getCarbonServiceRole,getPermissionCacheKey,} from "@carbon/auth";-import { flash, getAuthSession } from "@carbon/auth/session.server";+import { setCompanyId } from "@carbon/auth/company.server";+import {+ flash,+ getAuthSession,+ updateCompanySession,+} from "@carbon/auth/session.server";import { redis } from "@carbon/kv";import { Button as _Button, Heading as _Heading, VStack } from "@carbon/react";import { updateSubscriptionQuantityForCompany } from "@carbon/stripe/stripe.server";@@ -66,7 +71,17 @@ export async function action({ request, params }: ActionFunctionArgs) {if (authSession) {await redis.del(getPermissionCacheKey(authSession.userId));- throw redirect(path.to.authenticatedRoot);+ const sessionCookie = await updateCompanySession(+ request,+ accept.data.companyId+ );+ const companyIdCookie = setCompanyId(accept.data.companyId);+ throw redirect(path.to.authenticatedRoot, {+ headers: [+ ["Set-Cookie", sessionCookie],+ ["Set-Cookie", companyIdCookie],+ ],+ });} else {const magicLink = await serviceRole.auth.admin.generateLink({type: "magiclink",