mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
feat: signup confirm password
This commit is contained in:
parent
1c83f48c45
commit
b510f21a5b
3 changed files with 32 additions and 2 deletions
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
<div class="w-full absolute top-0 left-0 right-0 h-8 drag-region" />
|
||||
|
||||
{#if loaded}
|
||||
|
||||
|
||||
<div
|
||||
class="fixed bg-transparent min-h-screen w-full flex justify-center font-primary z-50 text-black dark:text-white"
|
||||
id="auth-container"
|
||||
|
|
@ -300,6 +304,26 @@
|
|||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if mode === 'signup' && $config?.features?.enable_signup_password_confirmation}
|
||||
<div class="mt-2">
|
||||
<label
|
||||
for="confirm-password"
|
||||
class="text-sm font-medium text-left mb-1 block"
|
||||
>{$i18n.t('Confirm Password')}</label
|
||||
>
|
||||
<input
|
||||
bind:value={confirmPassword}
|
||||
type="password"
|
||||
id="confirm-password"
|
||||
class="my-0.5 w-full text-sm outline-hidden bg-transparent"
|
||||
placeholder={$i18n.t('Confirm Your Password')}
|
||||
autocomplete="new-password"
|
||||
name="confirm-password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="mt-5">
|
||||
|
|
|
|||
Loading…
Reference in a new issue