Restore enterprise/LDAP login mode detection

- Added /users/auth-mode public endpoint to detect LDAP status
- Updated frontend to call getAuthMode() instead of hardcoded false
- Login page now automatically switches to enterprise mode when LDAP is enabled
- Fixes missing LDAP user login UI that was previously disabled with TODO comment

This restores the functionality that was commented out earlier where the login
page would auto-detect whether to show local user list or enterprise username input.
This commit is contained in:
2026-04-26 13:27:46 +03:00
parent 53eb6b50dd
commit dc999991a5
6 changed files with 32 additions and 10 deletions

View File

@@ -5,7 +5,7 @@
@tailwind utilities;
@layer base {
:root {
:root {
/* Base colors from DESIGN.md - AUTO-GENERATED from colors.mjs */
/* Base colors from DESIGN.md */
@@ -87,6 +87,8 @@
}
* {
@apply border-border;
border-radius: 0 !important;

View File

@@ -23,15 +23,15 @@ export default function LoginPage() {
const checkMode = async () => {
try {
setIsLoading(true);
// TODO: getNetworkConfig() method not implemented in API
// const config = await inventoryApi.getNetworkConfig();
// setIsEnterprise(config.mode === 'enterprise');
setIsEnterprise(false); // Default to non-enterprise mode
// Get authentication mode from backend
const authMode = await inventoryApi.getAuthMode();
setIsEnterprise(authMode.mode === 'enterprise');
const userList = await inventoryApi.getUsers();
setUsers(userList);
} catch (error) {
console.error("Failed to load users", error);
console.error("Failed to load auth mode or users", error);
setIsEnterprise(false); // Default to local mode on error
} finally {
setIsLoading(false);
}

View File

@@ -85,6 +85,12 @@ axiosInstance.interceptors.response.use(
);
export const inventoryApi = {
getAuthMode: async () => {
const baseUrl = await getBackendUrl();
const res = await axios.get(`${baseUrl}/users/auth-mode`);
return res.data;
},
getItems: async () => {
const res = await axiosInstance.get('/items/');
return res.data;