From a904f874ee297402b694013620fd32b6825bc19d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 12 May 2025 20:03:40 +0400 Subject: [PATCH] fix: admin signup logic --- backend/open_webui/routers/auths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index 309862ed5..70eea3c97 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -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 ) - 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. if len(form_data.password.encode("utf-8")) > 72: raise HTTPException( @@ -541,6 +537,10 @@ async def signup(request: Request, response: Response, form_data: SignupForm): 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 { "token": token, "token_type": "Bearer",