feat: do not allow user_id_only login for admins (#2904)
This commit is contained in:
@@ -110,6 +110,10 @@ async def login_usr(data: LoginUsr) -> JSONResponse:
|
||||
account = await get_account(data.usr)
|
||||
if not account:
|
||||
raise HTTPException(HTTPStatus.UNAUTHORIZED, "User ID does not exist.")
|
||||
if account.is_admin:
|
||||
raise HTTPException(
|
||||
HTTPStatus.UNAUTHORIZED, "Admin users cannot login with user id only."
|
||||
)
|
||||
return _auth_success_response(account.username, account.id, account.email)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user