diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index 01c6f0468b..8cddfc6b08 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -378,6 +378,10 @@ except ValueError: #################################### WEBUI_AUTH = os.environ.get("WEBUI_AUTH", "True").lower() == "true" +ENABLE_SIGNUP_PASSWORD_CONFIRMATION = ( + os.environ.get("ENABLE_SIGNUP_PASSWORD_CONFIRMATION", "False").lower() == "true" +) + WEBUI_AUTH_TRUSTED_EMAIL_HEADER = os.environ.get( "WEBUI_AUTH_TRUSTED_EMAIL_HEADER", None ) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 322a7f72ad..043a5bccec 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -412,6 +412,7 @@ from open_webui.env import ( WEBUI_SECRET_KEY, WEBUI_SESSION_COOKIE_SAME_SITE, WEBUI_SESSION_COOKIE_SECURE, + ENABLE_SIGNUP_PASSWORD_CONFIRMATION, WEBUI_AUTH_TRUSTED_EMAIL_HEADER, WEBUI_AUTH_TRUSTED_NAME_HEADER, WEBUI_AUTH_SIGNOUT_REDIRECT_URL, @@ -1570,6 +1571,7 @@ async def get_app_config(request: Request): "features": { "auth": WEBUI_AUTH, "auth_trusted_header": bool(app.state.AUTH_TRUSTED_EMAIL_HEADER), + "enable_signup_password_confirmation": ENABLE_SIGNUP_PASSWORD_CONFIRMATION, "enable_ldap": app.state.config.ENABLE_LDAP, "enable_api_key": app.state.config.ENABLE_API_KEY, "enable_signup": app.state.config.ENABLE_SIGNUP, diff --git a/src/routes/auth/+page.svelte b/src/routes/auth/+page.svelte index 5017023442..b2c936162c 100644 --- a/src/routes/auth/+page.svelte +++ b/src/routes/auth/+page.svelte @@ -28,6 +28,7 @@ let name = ''; let email = ''; let password = ''; + let confirmPassword = ''; let ldapUsername = ''; @@ -63,6 +64,11 @@ }; const signUpHandler = async () => { + if (password !== confirmPassword) { + toast.error($i18n.t('Passwords do not match.')); + return; + } + const sessionUser = await userSignUp(name, email, password, generateInitialsImage(name)).catch( (error) => { toast.error(`${error}`); @@ -178,8 +184,6 @@
{#if loaded} - -
+ + {#if mode === 'signup' && $config?.features?.enable_signup_password_confirmation} +
+ + +
+ {/if}
{/if}