mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
4d4c572bba
commit
b4c4d9baf5
1 changed files with 9 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import time
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
import urllib
|
||||||
|
|
||||||
from open_webui.models.auths import (
|
from open_webui.models.auths import (
|
||||||
AddUserForm,
|
AddUserForm,
|
||||||
|
|
@ -499,6 +500,10 @@ async def signin(request: Request, response: Response, form_data: SigninForm):
|
||||||
|
|
||||||
if WEBUI_AUTH_TRUSTED_NAME_HEADER:
|
if WEBUI_AUTH_TRUSTED_NAME_HEADER:
|
||||||
name = request.headers.get(WEBUI_AUTH_TRUSTED_NAME_HEADER, email)
|
name = request.headers.get(WEBUI_AUTH_TRUSTED_NAME_HEADER, email)
|
||||||
|
try:
|
||||||
|
name = urllib.parse.unquote(name, encoding="utf-8")
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
if not Users.get_user_by_email(email.lower()):
|
if not Users.get_user_by_email(email.lower()):
|
||||||
await signup(
|
await signup(
|
||||||
|
|
@ -695,7 +700,7 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
||||||
# Disable signup after the first user is created
|
# Disable signup after the first user is created
|
||||||
request.app.state.config.ENABLE_SIGNUP = False
|
request.app.state.config.ENABLE_SIGNUP = False
|
||||||
|
|
||||||
default_group_id = getattr(request.app.state.config, 'DEFAULT_GROUP_ID', "")
|
default_group_id = getattr(request.app.state.config, "DEFAULT_GROUP_ID", "")
|
||||||
if default_group_id and default_group_id:
|
if default_group_id and default_group_id:
|
||||||
Groups.add_users_to_group(default_group_id, [user.id])
|
Groups.add_users_to_group(default_group_id, [user.id])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue