From 98cea8aaa441d8b72f2e532e371fcb78b69600f2 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 3 Nov 2024 01:25:41 -0800 Subject: [PATCH] refac: automatically disable new sign ups after first user --- backend/open_webui/apps/webui/routers/auths.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/open_webui/apps/webui/routers/auths.py b/backend/open_webui/apps/webui/routers/auths.py index ef0a0d445..ae7938ef1 100644 --- a/backend/open_webui/apps/webui/routers/auths.py +++ b/backend/open_webui/apps/webui/routers/auths.py @@ -260,6 +260,11 @@ async def signup(request: Request, response: Response, form_data: SignupForm): if Users.get_num_users() == 0 else request.app.state.config.DEFAULT_USER_ROLE ) + + if Users.get_num_users() == 0: + # Disable signup after the first user is created + request.app.state.config.ENABLE_SIGNUP = False + hashed = get_password_hash(form_data.password) user = Auths.insert_new_auth( form_data.email.lower(),