Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

return process.env on server

Sara Vieirad5f85d813226
diff --git a/app/auth/login.tsx b/app/auth/login.tsx
index ef433b2694..1427155342 100644
--- a/app/auth/login.tsx
+++ b/app/auth/login.tsx
@@ -1,5 +1,5 @@
import { LinksFunction, MetaFunction } from "@remix-run/node";
-import { Form } from "@remix-run/react";
+import { Form, useLoaderData } from "@remix-run/react";
import { useState } from "react";
import { Button, Card, Flex, Heading, TextField } from "~/shared/design-system";
import interStyles from "~/shared/font-faces/inter.css";
@@ -26,6 +26,7 @@ export const meta: MetaFunction = () => {
export const Login = () => {
const [isDevLogin, setIsDevLogin] = useState(false);
+ const loaderData = useLoaderData();
return (
<Flex
@@ -55,7 +56,7 @@ export const Login = () => {
</Flex>
</Button>
</Form>
- {process.env.DEV_LOGIN && (
+ {loaderData.devLogin && (
<>
{isDevLogin ? (
<Form action="/auth/dev" method="post">
diff --git a/app/routes/login/index.tsx b/app/routes/login/index.tsx
index 916b4cc724..091979a839 100644
--- a/app/routes/login/index.tsx
+++ b/app/routes/login/index.tsx
@@ -13,7 +13,7 @@ export const loader: LoaderFunction = async ({ request }) => {
return redirect(config.dashboardPath);
}
- return {};
+ return { devLogin: process.env.DEV_LOGIN === "true" };
};
const LoginRoute = () => {
diff --git a/app/services/auth.server.ts b/app/services/auth.server.ts
index 1809d92280..56058e340c 100644
--- a/app/services/auth.server.ts
+++ b/app/services/auth.server.ts
@@ -51,7 +51,7 @@ if (process.env.GH_CLIENT_ID && process.env.GH_CLIENT_SECRET) {
authenticator.use(google, "google");
}
-if (process.env.DEV_LOGIN) {
+if (process.env.DEV_LOGIN === "true") {
authenticator.use(
new FormStrategy(async ({ form }) => {
const secret = form.get("secret");