refac: disable ldap by default
This commit is contained in:
		
							parent
							
								
									040449be01
								
							
						
					
					
						commit
						2910cbe9a9
					
				| 
						 | 
					@ -1595,7 +1595,7 @@ AUDIO_TTS_AZURE_SPEECH_OUTPUT_FORMAT = PersistentConfig(
 | 
				
			||||||
ENABLE_LDAP = PersistentConfig(
 | 
					ENABLE_LDAP = PersistentConfig(
 | 
				
			||||||
    "ENABLE_LDAP",
 | 
					    "ENABLE_LDAP",
 | 
				
			||||||
    "ldap.enable",
 | 
					    "ldap.enable",
 | 
				
			||||||
    os.environ.get("ENABLE_LDAP", "True").lower() == "true",
 | 
					    os.environ.get("ENABLE_LDAP", "false").lower() == "true",
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LDAP_SERVER_LABEL = PersistentConfig(
 | 
					LDAP_SERVER_LABEL = PersistentConfig(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 signInHandler = async () => {
 | 
				
			||||||
		const sessionUser = await userSignIn(email, password).catch((error) => {
 | 
							const sessionUser = await userSignIn(email, password).catch((error) => {
 | 
				
			||||||
			toast.error(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 () => {
 | 
						const checkOauthCallback = async () => {
 | 
				
			||||||
		if (!$page.url.hash) {
 | 
							if (!$page.url.hash) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -340,7 +340,7 @@
 | 
				
			||||||
							<div class="flex flex-col space-y-2">
 | 
												<div class="flex flex-col space-y-2">
 | 
				
			||||||
								{#if $config?.oauth?.providers?.google}
 | 
													{#if $config?.oauth?.providers?.google}
 | 
				
			||||||
									<button
 | 
														<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={() => {
 | 
															on:click={() => {
 | 
				
			||||||
											window.location.href = `${WEBUI_BASE_URL}/oauth/google/login`;
 | 
																window.location.href = `${WEBUI_BASE_URL}/oauth/google/login`;
 | 
				
			||||||
										}}
 | 
															}}
 | 
				
			||||||
| 
						 | 
					@ -365,7 +365,7 @@
 | 
				
			||||||
								{/if}
 | 
													{/if}
 | 
				
			||||||
								{#if $config?.oauth?.providers?.microsoft}
 | 
													{#if $config?.oauth?.providers?.microsoft}
 | 
				
			||||||
									<button
 | 
														<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={() => {
 | 
															on:click={() => {
 | 
				
			||||||
											window.location.href = `${WEBUI_BASE_URL}/oauth/microsoft/login`;
 | 
																window.location.href = `${WEBUI_BASE_URL}/oauth/microsoft/login`;
 | 
				
			||||||
										}}
 | 
															}}
 | 
				
			||||||
| 
						 | 
					@ -390,7 +390,7 @@
 | 
				
			||||||
								{/if}
 | 
													{/if}
 | 
				
			||||||
								{#if $config?.oauth?.providers?.oidc}
 | 
													{#if $config?.oauth?.providers?.oidc}
 | 
				
			||||||
									<button
 | 
														<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={() => {
 | 
															on:click={() => {
 | 
				
			||||||
											window.location.href = `${WEBUI_BASE_URL}/oauth/oidc/login`;
 | 
																window.location.href = `${WEBUI_BASE_URL}/oauth/oidc/login`;
 | 
				
			||||||
										}}
 | 
															}}
 | 
				
			||||||
| 
						 | 
					@ -417,9 +417,10 @@
 | 
				
			||||||
										>
 | 
															>
 | 
				
			||||||
									</button>
 | 
														</button>
 | 
				
			||||||
								{/if}
 | 
													{/if}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
								{#if showSwitchButtonForSignInForm}
 | 
													{#if showSwitchButtonForSignInForm}
 | 
				
			||||||
									<button
 | 
														<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={() => {
 | 
															on:click={() => {
 | 
				
			||||||
											if (mode === 'ldap')
 | 
																if (mode === 'ldap')
 | 
				
			||||||
												mode = ($config?.onboarding ?? false) ? 'signup' : 'signin';
 | 
																	mode = ($config?.onboarding ?? false) ? 'signup' : 'signin';
 | 
				
			||||||
| 
						 | 
					@ -433,7 +434,7 @@
 | 
				
			||||||
												fill="none"
 | 
																	fill="none"
 | 
				
			||||||
												stroke-width="1.5"
 | 
																	stroke-width="1.5"
 | 
				
			||||||
												stroke="currentColor"
 | 
																	stroke="currentColor"
 | 
				
			||||||
												class="size-6 mr-3"
 | 
																	class="size-4 mr-3"
 | 
				
			||||||
											>
 | 
																>
 | 
				
			||||||
												<path
 | 
																	<path
 | 
				
			||||||
													stroke-linecap="round"
 | 
																		stroke-linecap="round"
 | 
				
			||||||
| 
						 | 
					@ -458,7 +459,7 @@
 | 
				
			||||||
												viewBox="0 0 24 24"
 | 
																	viewBox="0 0 24 24"
 | 
				
			||||||
												stroke-width="1.5"
 | 
																	stroke-width="1.5"
 | 
				
			||||||
												stroke="currentColor"
 | 
																	stroke="currentColor"
 | 
				
			||||||
												class="size-6 mr-3"
 | 
																	class="size-4 mr-3"
 | 
				
			||||||
											>
 | 
																>
 | 
				
			||||||
												<path
 | 
																	<path
 | 
				
			||||||
													stroke-linecap="round"
 | 
																		stroke-linecap="round"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue