Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Hide org slug input when default slug is set

Daniel Hougaarde1a4185f76f1
diff --git a/frontend/src/views/Login/LoginLDAP.tsx b/frontend/src/views/Login/LoginLDAP.tsx
index 021ac73342..2784398085 100644
--- a/frontend/src/views/Login/LoginLDAP.tsx
+++ b/frontend/src/views/Login/LoginLDAP.tsx
@@ -4,15 +4,19 @@ import { useRouter } from "next/router";
import { createNotification } from "@app/components/notifications";
import { Button, Input } from "@app/components/v2";
+import { useServerConfig } from "@app/context";
import { loginLDAPRedirect } from "@app/hooks/api/auth/queries";
export const LoginLDAP = () => {
const router = useRouter();
+ const { config } = useServerConfig();
const queryParams = new URLSearchParams(window.location.search);
const passedOrgSlug = queryParams.get("organizationSlug");
const passedUsername = queryParams.get("username");
- const [organizationSlug, setOrganizationSlug] = useState(passedOrgSlug || "");
+ const [organizationSlug, setOrganizationSlug] = useState(
+ config.defaultOrgSlug || passedOrgSlug || ""
+ );
const [username, setUsername] = useState(passedUsername || "");
const [password, setPassword] = useState("");
@@ -63,21 +67,23 @@ export const LoginLDAP = () => {
What's your LDAP Login?
</p>
<form onSubmit={handleSubmission}>
- <div className="relative mx-auto flex max-h-24 w-1/4 w-full min-w-[20rem] items-center justify-center rounded-lg md:max-h-28 md:min-w-[22rem] lg:w-1/6">
- <div className="flex max-h-24 w-full items-center justify-center rounded-lg md:max-h-28">
- <Input
- value={organizationSlug}
- onChange={(e) => setOrganizationSlug(e.target.value)}
- type="text"
- placeholder="Enter your organization slug..."
- isRequired
- autoComplete="email"
- id="email"
- className="h-12"
- isDisabled={passedOrgSlug !== null}
- />
+ {!config.defaultOrgSlug && (
+ <div className="relative mx-auto flex max-h-24 w-1/4 w-full min-w-[20rem] items-center justify-center rounded-lg md:max-h-28 md:min-w-[22rem] lg:w-1/6">
+ <div className="flex max-h-24 w-full items-center justify-center rounded-lg md:max-h-28">
+ <Input
+ value={organizationSlug}
+ onChange={(e) => setOrganizationSlug(e.target.value)}
+ type="text"
+ placeholder="Enter your organization slug..."
+ isRequired
+ autoComplete="email"
+ id="email"
+ className="h-12"
+ isDisabled={passedOrgSlug !== null}
+ />
+ </div>
</div>
- </div>
+ )}
<div className="relative mx-auto mt-2 flex max-h-24 w-1/4 w-full min-w-[20rem] items-center justify-center rounded-lg md:max-h-28 md:min-w-[22rem] lg:w-1/6">
<div className="flex max-h-24 w-full items-center justify-center rounded-lg md:max-h-28">
<Input