@@ -13,6 +13,7 @@ import { FaGithub } from 'react-icons/fa6';
1313import { useNavigate } from 'react-router-dom' ;
1414import { useAuth } from '../../lib/authContext' ;
1515import { useNotification } from '../Shared/NotificationSystem' ;
16+ import { API_URL } from '../../lib/api-client/urls' ;
1617
1718export default function LoginForm ( ) {
1819 const [ email , setEmail ] = useState ( '' ) ;
@@ -28,6 +29,38 @@ export default function LoginForm() {
2829 const { addNotification } = useNotification ( ) ;
2930 const navigate = useNavigate ( ) ;
3031
32+ // Auto-login for single user mode
33+ useEffect ( ( ) => {
34+ const autoLogin = async ( ) => {
35+ // Only attempt auto-login if we have a valid API URL (connection is established)
36+ const apiUrl = API_URL ( ) ;
37+ if ( ! apiUrl ) {
38+ console . log ( 'Skipping auto-login: no API URL available.' ) ;
39+ return ;
40+ }
41+
42+ // Only auto-login if MULTIUSER is not enabled
43+ // Check window.platform first (cloud mode), then fallback to process.env
44+ const isMultiUserMode =
45+ ( window as any ) . platform ?. multiuser === true ||
46+ ( typeof process !== 'undefined' &&
47+ process . env &&
48+ process . env . MULTIUSER === 'true' ) ;
49+ if ( isMultiUserMode ) {
50+ return ;
51+ }
52+
53+ try {
54+ console . log ( 'Attempting auto-login for single user mode' ) ;
55+ await login ( 'admin@example.com' , 'admin123' ) ;
56+ } catch ( error ) {
57+ console . error ( 'Auto-login failed:' , error ) ;
58+ }
59+ } ;
60+
61+ autoLogin ( ) ;
62+ } , [ login ] ) ;
63+
3164 // Check OAuth status on component mount
3265 useEffect ( ( ) => {
3366 const checkOAuthStatus = async ( ) => {
0 commit comments