mirror of
https://github.com/open-webui/open-webui
synced 2025-04-27 17:51:31 +00:00
Merge pull request #4068 from Louden7/main
feat: Added environment variable to hide email and password sign in elements
This commit is contained in:
commit
065d23d0b1
@ -35,6 +35,7 @@ from config import (
|
|||||||
DEFAULT_PROMPT_SUGGESTIONS,
|
DEFAULT_PROMPT_SUGGESTIONS,
|
||||||
DEFAULT_USER_ROLE,
|
DEFAULT_USER_ROLE,
|
||||||
ENABLE_SIGNUP,
|
ENABLE_SIGNUP,
|
||||||
|
ENABLE_LOGIN_FORM,
|
||||||
USER_PERMISSIONS,
|
USER_PERMISSIONS,
|
||||||
WEBHOOK_URL,
|
WEBHOOK_URL,
|
||||||
WEBUI_AUTH_TRUSTED_EMAIL_HEADER,
|
WEBUI_AUTH_TRUSTED_EMAIL_HEADER,
|
||||||
@ -64,6 +65,7 @@ origins = ["*"]
|
|||||||
app.state.config = AppConfig()
|
app.state.config = AppConfig()
|
||||||
|
|
||||||
app.state.config.ENABLE_SIGNUP = ENABLE_SIGNUP
|
app.state.config.ENABLE_SIGNUP = ENABLE_SIGNUP
|
||||||
|
app.state.config.ENABLE_LOGIN_FORM = ENABLE_LOGIN_FORM
|
||||||
app.state.config.JWT_EXPIRES_IN = JWT_EXPIRES_IN
|
app.state.config.JWT_EXPIRES_IN = JWT_EXPIRES_IN
|
||||||
app.state.AUTH_TRUSTED_EMAIL_HEADER = WEBUI_AUTH_TRUSTED_EMAIL_HEADER
|
app.state.AUTH_TRUSTED_EMAIL_HEADER = WEBUI_AUTH_TRUSTED_EMAIL_HEADER
|
||||||
app.state.AUTH_TRUSTED_NAME_HEADER = WEBUI_AUTH_TRUSTED_NAME_HEADER
|
app.state.AUTH_TRUSTED_NAME_HEADER = WEBUI_AUTH_TRUSTED_NAME_HEADER
|
||||||
|
@ -719,6 +719,12 @@ ENABLE_SIGNUP = PersistentConfig(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ENABLE_LOGIN_FORM = PersistentConfig(
|
||||||
|
"ENABLE_LOGIN_FORM",
|
||||||
|
"ui.ENABLE_LOGIN_FORM",
|
||||||
|
os.environ.get("ENABLE_LOGIN_FORM", "True").lower() == "true",
|
||||||
|
)
|
||||||
|
|
||||||
DEFAULT_LOCALE = PersistentConfig(
|
DEFAULT_LOCALE = PersistentConfig(
|
||||||
"DEFAULT_LOCALE",
|
"DEFAULT_LOCALE",
|
||||||
"ui.default_locale",
|
"ui.default_locale",
|
||||||
|
@ -1995,6 +1995,7 @@ async def get_app_config():
|
|||||||
"auth": WEBUI_AUTH,
|
"auth": WEBUI_AUTH,
|
||||||
"auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
|
"auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
|
||||||
"enable_signup": webui_app.state.config.ENABLE_SIGNUP,
|
"enable_signup": webui_app.state.config.ENABLE_SIGNUP,
|
||||||
|
"enable_login_form": webui_app.state.config.ENABLE_LOGIN_FORM,
|
||||||
"enable_web_search": rag_app.state.config.ENABLE_RAG_WEB_SEARCH,
|
"enable_web_search": rag_app.state.config.ENABLE_RAG_WEB_SEARCH,
|
||||||
"enable_image_generation": images_app.state.config.ENABLED,
|
"enable_image_generation": images_app.state.config.ENABLED,
|
||||||
"enable_community_sharing": webui_app.state.config.ENABLE_COMMUNITY_SHARING,
|
"enable_community_sharing": webui_app.state.config.ENABLE_COMMUNITY_SHARING,
|
||||||
|
@ -145,6 +145,7 @@ type Config = {
|
|||||||
auth: boolean;
|
auth: boolean;
|
||||||
auth_trusted_header: boolean;
|
auth_trusted_header: boolean;
|
||||||
enable_signup: boolean;
|
enable_signup: boolean;
|
||||||
|
enable_login_form: boolean;
|
||||||
enable_web_search?: boolean;
|
enable_web_search?: boolean;
|
||||||
enable_image_generation: boolean;
|
enable_image_generation: boolean;
|
||||||
enable_admin_export: boolean;
|
enable_admin_export: boolean;
|
||||||
|
@ -173,88 +173,94 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col mt-4">
|
{#if $config?.features.enable_login_form}
|
||||||
{#if mode === 'signup'}
|
<div class="flex flex-col mt-4">
|
||||||
<div>
|
{#if mode === 'signup'}
|
||||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Name')}</div>
|
<div>
|
||||||
|
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Name')}</div>
|
||||||
|
<input
|
||||||
|
bind:value={name}
|
||||||
|
type="text"
|
||||||
|
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
||||||
|
autocomplete="name"
|
||||||
|
placeholder={$i18n.t('Enter Your Full Name')}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class=" my-3 dark:border-gray-900" />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Email')}</div>
|
||||||
<input
|
<input
|
||||||
bind:value={name}
|
bind:value={email}
|
||||||
type="text"
|
type="email"
|
||||||
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
||||||
autocomplete="name"
|
autocomplete="email"
|
||||||
placeholder={$i18n.t('Enter Your Full Name')}
|
placeholder={$i18n.t('Enter Your Email')}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class=" my-3 dark:border-gray-900" />
|
<div>
|
||||||
{/if}
|
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Password')}</div>
|
||||||
|
|
||||||
<div class="mb-2">
|
<input
|
||||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Email')}</div>
|
bind:value={password}
|
||||||
<input
|
type="password"
|
||||||
bind:value={email}
|
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
||||||
type="email"
|
placeholder={$i18n.t('Enter Your Password')}
|
||||||
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
autocomplete="current-password"
|
||||||
autocomplete="email"
|
required
|
||||||
placeholder={$i18n.t('Enter Your Email')}
|
/>
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Password')}</div>
|
|
||||||
|
|
||||||
<input
|
|
||||||
bind:value={password}
|
|
||||||
type="password"
|
|
||||||
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
|
||||||
placeholder={$i18n.t('Enter Your Password')}
|
|
||||||
autocomplete="current-password"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5">
|
|
||||||
<button
|
|
||||||
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-2xl text-white font-medium text-sm py-3 transition"
|
|
||||||
type="submit"
|
|
||||||
>
|
|
||||||
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#if $config?.features.enable_signup}
|
|
||||||
<div class=" mt-4 text-sm text-center">
|
|
||||||
{mode === 'signin'
|
|
||||||
? $i18n.t("Don't have an account?")
|
|
||||||
: $i18n.t('Already have an account?')}
|
|
||||||
|
|
||||||
<button
|
|
||||||
class=" font-medium underline"
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
if (mode === 'signin') {
|
|
||||||
mode = 'signup';
|
|
||||||
} else {
|
|
||||||
mode = 'signin';
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
|
|
||||||
|
{#if $config?.features.enable_login_form}
|
||||||
|
<div class="mt-5">
|
||||||
|
<button
|
||||||
|
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-2xl text-white font-medium text-sm py-3 transition"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
|
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{#if $config?.features.enable_signup}
|
||||||
|
<div class=" mt-4 text-sm text-center">
|
||||||
|
{mode === 'signin'
|
||||||
|
? $i18n.t("Don't have an account?")
|
||||||
|
: $i18n.t('Already have an account?')}
|
||||||
|
|
||||||
|
<button
|
||||||
|
class=" font-medium underline"
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
if (mode === 'signin') {
|
||||||
|
mode = 'signup';
|
||||||
|
} else {
|
||||||
|
mode = 'signin';
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{mode === 'signin' ? $i18n.t('Sign up') : $i18n.t('Sign in')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#if Object.keys($config?.oauth?.providers ?? {}).length > 0}
|
{#if Object.keys($config?.oauth?.providers ?? {}).length > 0}
|
||||||
<div class="inline-flex items-center justify-center w-full">
|
<div class="inline-flex items-center justify-center w-full">
|
||||||
<hr class="w-64 h-px my-8 bg-gray-200 border-0 dark:bg-gray-700" />
|
<hr class="w-64 h-px my-8 bg-gray-200 border-0 dark:bg-gray-700" />
|
||||||
<span
|
{#if $config?.features.enable_login_form}
|
||||||
class="absolute px-3 font-medium text-gray-900 -translate-x-1/2 bg-white left-1/2 dark:text-white dark:bg-gray-950"
|
<span
|
||||||
>{$i18n.t('or')}</span
|
class="absolute px-3 font-medium text-gray-900 -translate-x-1/2 bg-white left-1/2 dark:text-white dark:bg-gray-950"
|
||||||
>
|
>{$i18n.t('or')}</span
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<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}
|
||||||
|
Loading…
Reference in New Issue
Block a user