瀏覽代碼

fix: webui_auth permission issue

Timothy J. Baek 11 月之前
父節點
當前提交
88e8f31c07
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      backend/apps/web/routers/auths.py

+ 3 - 1
backend/apps/web/routers/auths.py

@@ -131,7 +131,9 @@ async def signin(request: Request, form_data: SigninForm):
                     request,
                     request,
                     SignupForm(email=admin_email, password=admin_password, name="User"),
                     SignupForm(email=admin_email, password=admin_password, name="User"),
                 )
                 )
+
             user = Auths.authenticate_user(admin_email.lower(), admin_password)
             user = Auths.authenticate_user(admin_email.lower(), admin_password)
+
         else:
         else:
             user = Auths.authenticate_user(form_data.email.lower(), form_data.password)
             user = Auths.authenticate_user(form_data.email.lower(), form_data.password)
 
 
@@ -161,7 +163,7 @@ async def signin(request: Request, form_data: SigninForm):
 
 
 @router.post("/signup", response_model=SigninResponse)
 @router.post("/signup", response_model=SigninResponse)
 async def signup(request: Request, form_data: SignupForm):
 async def signup(request: Request, form_data: SignupForm):
-    if not request.app.state.ENABLE_SIGNUP:
+    if not request.app.state.ENABLE_SIGNUP and WEBUI_AUTH:
         raise HTTPException(
         raise HTTPException(
             status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
             status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED
         )
         )