diff --git a/.env.development b/.env.development index 32dd9588..6615d956 100644 --- a/.env.development +++ b/.env.development @@ -10,4 +10,7 @@ VITE_WEBSOCKET_PATH=/socket.io/ # MSAL Authentication (local development) VITE_MSAL_REDIRECT_URI=http://localhost:5173/ -VITE_MSAL_POST_LOGOUT_REDIRECT_URI=http://localhost:5173/ \ No newline at end of file +VITE_MSAL_POST_LOGOUT_REDIRECT_URI=http://localhost:5173/ + +# Local login (username/password) - enable for development +VITE_ENABLE_LOCAL_LOGIN=true \ No newline at end of file diff --git a/.env.production b/.env.production index a9465114..fc166f1c 100644 --- a/.env.production +++ b/.env.production @@ -10,4 +10,7 @@ VITE_WEBSOCKET_PATH=/semblance_back/socket.io/ # MSAL Authentication (production server) VITE_MSAL_REDIRECT_URI=https://ai-sandbox.oliver.solutions/semblance -VITE_MSAL_POST_LOGOUT_REDIRECT_URI=https://ai-sandbox.oliver.solutions/semblance \ No newline at end of file +VITE_MSAL_POST_LOGOUT_REDIRECT_URI=https://ai-sandbox.oliver.solutions/semblance + +# Local login (username/password) - disable for production +VITE_ENABLE_LOCAL_LOGIN=false \ No newline at end of file diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 54c53a92..c549d1c9 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -24,6 +24,9 @@ export default function Login() { const location = useLocation(); const { login, loginWithMicrosoft, isAuthenticated, isMsalLoading } = useAuth(); const [isLoading, setIsLoading] = useState(false); + + // Check if local login is enabled (defaults to true for backwards compatibility) + const enableLocalLogin = import.meta.env.VITE_ENABLE_LOCAL_LOGIN !== 'false'; // Get the intended destination from state, or default to home page const from = location.state?.from || '/'; @@ -120,70 +123,76 @@ export default function Login() { - {/* Divider */} -
-
-
-
-
- - Or continue with username - -
-
+ {enableLocalLogin && ( + <> + {/* Divider */} +
+
+
+
+
+ + Or continue with username + +
+
-
- - ( - - Username - - - - - - )} - /> - - ( - - Password - - - - - - )} - /> - - - - +
+ + ( + + Username + + + + + + )} + /> + + ( + + Password + + + + + + )} + /> + + + + + + )} -
- Default account: user / pass -
+ {enableLocalLogin && ( +
+ Default account: user / pass +
+ )} {!isLoading && !isMsalLoading && (