mirror of
https://github.com/open-webui/open-webui
synced 2025-02-20 03:48:48 +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_USER_ROLE,
|
||||
ENABLE_SIGNUP,
|
||||
ENABLE_LOGIN_FORM,
|
||||
USER_PERMISSIONS,
|
||||
WEBHOOK_URL,
|
||||
WEBUI_AUTH_TRUSTED_EMAIL_HEADER,
|
||||
@ -64,6 +65,7 @@ origins = ["*"]
|
||||
app.state.config = AppConfig()
|
||||
|
||||
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.AUTH_TRUSTED_EMAIL_HEADER = WEBUI_AUTH_TRUSTED_EMAIL_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",
|
||||
"ui.default_locale",
|
||||
|
@ -1995,6 +1995,7 @@ async def get_app_config():
|
||||
"auth": WEBUI_AUTH,
|
||||
"auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
|
||||
"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_image_generation": images_app.state.config.ENABLED,
|
||||
"enable_community_sharing": webui_app.state.config.ENABLE_COMMUNITY_SHARING,
|
||||
|
@ -145,6 +145,7 @@ type Config = {
|
||||
auth: boolean;
|
||||
auth_trusted_header: boolean;
|
||||
enable_signup: boolean;
|
||||
enable_login_form: boolean;
|
||||
enable_web_search?: boolean;
|
||||
enable_image_generation: boolean;
|
||||
enable_admin_export: boolean;
|
||||
|
@ -173,88 +173,94 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col mt-4">
|
||||
{#if mode === 'signup'}
|
||||
<div>
|
||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Name')}</div>
|
||||
{#if $config?.features.enable_login_form}
|
||||
<div class="flex flex-col mt-4">
|
||||
{#if mode === 'signup'}
|
||||
<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
|
||||
bind:value={name}
|
||||
type="text"
|
||||
bind:value={email}
|
||||
type="email"
|
||||
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')}
|
||||
autocomplete="email"
|
||||
placeholder={$i18n.t('Enter Your Email')}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<hr class=" my-3 dark:border-gray-900" />
|
||||
{/if}
|
||||
<div>
|
||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Password')}</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<div class=" text-sm font-medium text-left mb-1">{$i18n.t('Email')}</div>
|
||||
<input
|
||||
bind:value={email}
|
||||
type="email"
|
||||
class=" px-5 py-3 rounded-2xl w-full text-sm outline-none border dark:border-none dark:bg-gray-900"
|
||||
autocomplete="email"
|
||||
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>
|
||||
<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>
|
||||
{/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>
|
||||
|
||||
{#if Object.keys($config?.oauth?.providers ?? {}).length > 0}
|
||||
<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" />
|
||||
<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 $config?.features.enable_login_form}
|
||||
<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 class="flex flex-col space-y-2">
|
||||
{#if $config?.oauth?.providers?.google}
|
||||
|
Loading…
Reference in New Issue
Block a user