diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index c0650e444..d06220692 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -2216,16 +2216,17 @@ async def get_app_config(request: Request): if data is not None and "id" in data: user = Users.get_user_by_id(data["id"]) - user_count = 0 + onboarding = False if user is None: user_count = Users.get_num_users() + onboarding = user_count == 0 return { + **({"onboarding": True} if onboarding else {}), "status": True, "name": WEBUI_NAME, "version": VERSION, "default_locale": str(DEFAULT_LOCALE), - **({"onboarding": True} if user_count is 0 else {}), "oauth": { "providers": { name: config.get("name", name) diff --git a/src/routes/auth/+page.svelte b/src/routes/auth/+page.svelte index 96a6cd1ee..f40307816 100644 --- a/src/routes/auth/+page.svelte +++ b/src/routes/auth/+page.svelte @@ -27,7 +27,6 @@ let password = ''; let ldapUsername = ''; - let ldapPassword = ''; const setSessionUser = async (sessionUser) => { if (sessionUser) { @@ -64,6 +63,14 @@ await setSessionUser(sessionUser); }; + const ldapSignInHandler = async () => { + const sessionUser = await ldapUserSignIn(ldapUsername, password).catch((error) => { + toast.error(error); + return null; + }); + await setSessionUser(sessionUser); + }; + const submitHandler = async () => { if (mode === 'ldap') { await ldapSignInHandler(); @@ -74,14 +81,6 @@ } }; - const ldapSignInHandler = async () => { - const sessionUser = await ldapUserSignIn(ldapUsername, ldapPassword).catch((error) => { - toast.error(error); - return null; - }); - await setSessionUser(sessionUser); - }; - const checkOauthCallback = async () => { if (!$page.url.hash) { return; @@ -113,6 +112,7 @@ await goto('/'); } await checkOauthCallback(); + loaded = true; if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) { await signInHandler(); @@ -175,7 +175,8 @@