mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
fix: admin signup logic
This commit is contained in:
parent
e9b799676b
commit
a904f874ee
1 changed files with 4 additions and 4 deletions
|
|
@ -478,10 +478,6 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
||||||
"admin" if user_count == 0 else request.app.state.config.DEFAULT_USER_ROLE
|
"admin" if user_count == 0 else request.app.state.config.DEFAULT_USER_ROLE
|
||||||
)
|
)
|
||||||
|
|
||||||
if user_count == 0:
|
|
||||||
# Disable signup after the first user is created
|
|
||||||
request.app.state.config.ENABLE_SIGNUP = False
|
|
||||||
|
|
||||||
# The password passed to bcrypt must be 72 bytes or fewer. If it is longer, it will be truncated before hashing.
|
# The password passed to bcrypt must be 72 bytes or fewer. If it is longer, it will be truncated before hashing.
|
||||||
if len(form_data.password.encode("utf-8")) > 72:
|
if len(form_data.password.encode("utf-8")) > 72:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|
@ -541,6 +537,10 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
||||||
user.id, request.app.state.config.USER_PERMISSIONS
|
user.id, request.app.state.config.USER_PERMISSIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if user_count == 0:
|
||||||
|
# Disable signup after the first user is created
|
||||||
|
request.app.state.config.ENABLE_SIGNUP = False
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"token": token,
|
"token": token,
|
||||||
"token_type": "Bearer",
|
"token_type": "Bearer",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue