mirror of
https://github.com/open-webui/open-webui
synced 2025-02-23 13:51:07 +00:00
refac
This commit is contained in:
parent
ba6cde8a87
commit
658944e756
@ -423,7 +423,6 @@ async def signin(request: Request, response: Response, form_data: SigninForm):
|
|||||||
|
|
||||||
@router.post("/signup", response_model=SessionUserResponse)
|
@router.post("/signup", response_model=SessionUserResponse)
|
||||||
async def signup(request: Request, response: Response, form_data: SignupForm):
|
async def signup(request: Request, response: Response, form_data: SignupForm):
|
||||||
user_count = Users.get_num_users()
|
|
||||||
|
|
||||||
if WEBUI_AUTH:
|
if WEBUI_AUTH:
|
||||||
if (
|
if (
|
||||||
@ -434,11 +433,12 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
|||||||
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if user_count != 0:
|
if Users.get_num_users() != 0:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
user_count = Users.get_num_users()
|
||||||
if request.app.state.USER_COUNT and user_count >= request.app.state.USER_COUNT:
|
if request.app.state.USER_COUNT and user_count >= request.app.state.USER_COUNT:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
||||||
|
Loading…
Reference in New Issue
Block a user