Skip to content

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

Fix: No orgs selectable if a user has been removed from an organization

Daniel Hougaard290d99e02cf4
diff --git a/frontend/src/pages/login/select-organization.tsx b/frontend/src/pages/login/select-organization.tsx
index de866a3235..22006408e2 100644
--- a/frontend/src/pages/login/select-organization.tsx
+++ b/frontend/src/pages/login/select-organization.tsx
@@ -121,6 +121,14 @@ export default function LoginPage() {
}
}, [router]);
+ // Case: User has no organizations.
+ // This can happen if the user was previously a member, but the organization was deleted or the user was removed.
+ useEffect(() => {
+ if (!organizations.isLoading && organizations.data?.length === 0) {
+ router.push("/org/none");
+ }
+ }, [organizations.isLoading, organizations.data]);
+
if (userLoading || !user) {
return <LoadingScreen />;
}