refac: disable ldap by default

This commit is contained in:
Timothy J. Baek 2024-11-05 19:58:54 -08:00
parent 040449be01
commit 2910cbe9a9
2 changed files with 16 additions and 15 deletions

View File

@ -1595,7 +1595,7 @@ AUDIO_TTS_AZURE_SPEECH_OUTPUT_FORMAT = PersistentConfig(
ENABLE_LDAP = PersistentConfig(
"ENABLE_LDAP",
"ldap.enable",
os.environ.get("ENABLE_LDAP", "True").lower() == "true",
os.environ.get("ENABLE_LDAP", "false").lower() == "true",
)
LDAP_SERVER_LABEL = PersistentConfig(

View File

@ -56,14 +56,6 @@
}
};
const ldapSignInHandler = async () => {
const sessionUser = await ldapUserSignIn(ldapUsername, ldapPassword).catch((error) => {
toast.error(error);
return null;
});
await setSessionUser(sessionUser);
};
const signInHandler = async () => {
const sessionUser = await userSignIn(email, password).catch((error) => {
toast.error(error);
@ -94,6 +86,14 @@
}
};
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;
@ -340,7 +340,7 @@
<div class="flex flex-col space-y-2">
{#if $config?.oauth?.providers?.google}
<button
class="bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
class="flex justify-center items-center bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
on:click={() => {
window.location.href = `${WEBUI_BASE_URL}/oauth/google/login`;
}}
@ -365,7 +365,7 @@
{/if}
{#if $config?.oauth?.providers?.microsoft}
<button
class="bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
class="flex justify-center items-center bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
on:click={() => {
window.location.href = `${WEBUI_BASE_URL}/oauth/microsoft/login`;
}}
@ -390,7 +390,7 @@
{/if}
{#if $config?.oauth?.providers?.oidc}
<button
class="bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
class="flex justify-center items-center bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
on:click={() => {
window.location.href = `${WEBUI_BASE_URL}/oauth/oidc/login`;
}}
@ -417,9 +417,10 @@
>
</button>
{/if}
{#if showSwitchButtonForSignInForm}
<button
class="bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
class="flex justify-center items-center bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
on:click={() => {
if (mode === 'ldap')
mode = ($config?.onboarding ?? false) ? 'signup' : 'signin';
@ -433,7 +434,7 @@
fill="none"
stroke-width="1.5"
stroke="currentColor"
class="size-6 mr-3"
class="size-4 mr-3"
>
<path
stroke-linecap="round"
@ -458,7 +459,7 @@
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6 mr-3"
class="size-4 mr-3"
>
<path
stroke-linecap="round"