From 7da86573b903f317a978255491d99febe06e4d83 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Sun, 26 Apr 2026 13:29:17 +0300 Subject: [PATCH] Add login mode toggle: allow switching between local and enterprise login - Added 'Local Users' and 'Enterprise' toggle buttons when LDAP is available - Users can now choose which login method to use - Defaults to local user list on page load - Both modes fully functional and accessible --- frontend/app/login/page.tsx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/frontend/app/login/page.tsx b/frontend/app/login/page.tsx index 773e0ae1..f5e959ea 100644 --- a/frontend/app/login/page.tsx +++ b/frontend/app/login/page.tsx @@ -9,6 +9,7 @@ import { useRouter } from 'next/navigation'; export default function LoginPage() { const [mounted, setMounted] = useState(false); const [users, setUsers] = useState([]); + const [ldapAvailable, setLdapAvailable] = useState(false); const [isEnterprise, setIsEnterprise] = useState(false); const [isLoading, setIsLoading] = useState(true); const [selectedUserForLogin, setSelectedUserForLogin] = useState(null); @@ -25,13 +26,15 @@ export default function LoginPage() { setIsLoading(true); // Get authentication mode from backend const authMode = await inventoryApi.getAuthMode(); - setIsEnterprise(authMode.mode === 'enterprise'); + setLdapAvailable(authMode.ldap_enabled); + setIsEnterprise(false); // Always start with local mode for user choice const userList = await inventoryApi.getUsers(); setUsers(userList); } catch (error) { console.error("Failed to load auth mode or users", error); - setIsEnterprise(false); // Default to local mode on error + setLdapAvailable(false); + setIsEnterprise(false); } finally { setIsLoading(false); } @@ -81,6 +84,32 @@ export default function LoginPage() { ) : (
+ {ldapAvailable && ( +
+ + +
+ )} {!selectedUserForLogin && !isEnterprise ? ( <> {users.length > 0 ? (