mirror of
https://github.com/open-webui/open-webui
synced 2025-05-17 20:05:08 +00:00
refac
This commit is contained in:
parent
8fb6b03ddc
commit
50dec12072
@ -252,14 +252,6 @@ async def ldap_auth(request: Request, response: Response, form_data: LdapForm):
|
|||||||
if not user:
|
if not user:
|
||||||
try:
|
try:
|
||||||
user_count = Users.get_num_users()
|
user_count = Users.get_num_users()
|
||||||
if (
|
|
||||||
request.app.state.USER_COUNT
|
|
||||||
and user_count >= request.app.state.USER_COUNT
|
|
||||||
):
|
|
||||||
raise HTTPException(
|
|
||||||
status.HTTP_403_FORBIDDEN,
|
|
||||||
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
|
|
||||||
)
|
|
||||||
|
|
||||||
role = (
|
role = (
|
||||||
"admin"
|
"admin"
|
||||||
@ -439,11 +431,6 @@ async def signup(request: Request, response: Response, form_data: SignupForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
user_count = Users.get_num_users()
|
user_count = Users.get_num_users()
|
||||||
if request.app.state.USER_COUNT and user_count >= request.app.state.USER_COUNT:
|
|
||||||
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(
|
||||||
status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.INVALID_EMAIL_FORMAT
|
status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.INVALID_EMAIL_FORMAT
|
||||||
|
@ -315,15 +315,6 @@ class OAuthManager:
|
|||||||
if not user:
|
if not user:
|
||||||
user_count = Users.get_num_users()
|
user_count = Users.get_num_users()
|
||||||
|
|
||||||
if (
|
|
||||||
request.app.state.USER_COUNT
|
|
||||||
and user_count >= request.app.state.USER_COUNT
|
|
||||||
):
|
|
||||||
raise HTTPException(
|
|
||||||
403,
|
|
||||||
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
|
|
||||||
)
|
|
||||||
|
|
||||||
# If the user does not exist, check if signups are enabled
|
# If the user does not exist, check if signups are enabled
|
||||||
if auth_manager_config.ENABLE_OAUTH_SIGNUP:
|
if auth_manager_config.ENABLE_OAUTH_SIGNUP:
|
||||||
# Check if an existing user with the same email already exists
|
# Check if an existing user with the same email already exists
|
||||||
|
Loading…
Reference in New Issue
Block a user