Merge pull request #5576 from open-webui/dev

fix: WEBUI_AUTH=False not working issue
This commit is contained in:
Timothy Jaeryang Baek 2024-09-21 15:35:55 +02:00 committed by GitHub
commit f47dffe6e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -188,14 +188,19 @@ async def signin(request: Request, response: Response, form_data: SigninForm):
@router.post("/signup", response_model=SigninResponse) @router.post("/signup", response_model=SigninResponse)
async def signup(request: Request, response: Response, form_data: SignupForm): async def signup(request: Request, response: Response, form_data: SignupForm):
if ( if WEBUI_AUTH:
not request.app.state.config.ENABLE_SIGNUP if (
or not request.app.state.config.ENABLE_LOGIN_FORM not request.app.state.config.ENABLE_SIGNUP
or not WEBUI_AUTH or not request.app.state.config.ENABLE_LOGIN_FORM
): ):
raise HTTPException( raise HTTPException(
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
) )
else:
if Users.get_num_users() != 0:
raise HTTPException(
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
)
if not validate_email_format(form_data.email.lower()): if not validate_email_format(form_data.email.lower()):
raise HTTPException( raise HTTPException(