Skip to content

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.

Refactor login loader to streamline authentication provider checks

naveenkashb5311bf66c76
diff --git a/apps/erp/app/routes/_public+/login.tsx b/apps/erp/app/routes/_public+/login.tsx
index 98bc6fb19f..db2e60fe46 100644
--- a/apps/erp/app/routes/_public+/login.tsx
+++ b/apps/erp/app/routes/_public+/login.tsx
@@ -1,5 +1,4 @@
import {
- AUTH_PROVIDERS,
assertIsPost,
CarbonEdition,
CLOUDFLARE_TURNSTILE_SECRET_KEY,
@@ -69,21 +68,21 @@ export const meta: MetaFunction = () => {
export async function loader({ request }: LoaderFunctionArgs) {
const authSession = await getAuthSession(request);
+ const hasOutlookAuth = isAuthProviderEnabled("azure");
+ const hasGoogleAuth = isAuthProviderEnabled("google");
+ const hasPasskeyAuth = isAuthProviderEnabled("passkey");
+
if (authSession) {
if (await verifyAuthSession(authSession)) {
throw redirect(path.to.authenticatedRoot);
}
const cookieHeaders = await clearAuthCookies(request);
return data(
- { providers: AUTH_PROVIDERS.split(",") },
+ { hasOutlookAuth, hasGoogleAuth, hasPasskeyAuth },
{ headers: cookieHeaders }
);
}
- const hasOutlookAuth = isAuthProviderEnabled("azure");
- const hasGoogleAuth = isAuthProviderEnabled("google");
- const hasPasskeyAuth = isAuthProviderEnabled("passkey");
-
return {
hasOutlookAuth,
hasGoogleAuth,