mirror of https://github.com/open-webui/open-webui
refac
This commit is contained in:
parent
9126ceac08
commit
00f6b4bf09
|
@ -188,12 +188,7 @@ 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 not WEBUI_AUTH:
|
if WEBUI_AUTH:
|
||||||
if Users.get_num_users() != 0:
|
|
||||||
raise HTTPException(
|
|
||||||
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
if (
|
if (
|
||||||
not request.app.state.config.ENABLE_SIGNUP
|
not request.app.state.config.ENABLE_SIGNUP
|
||||||
or not request.app.state.config.ENABLE_LOGIN_FORM
|
or not request.app.state.config.ENABLE_LOGIN_FORM
|
||||||
|
@ -201,6 +196,11 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
||||||
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(
|
||||||
|
|
Loading…
Reference in New Issue