mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 11:11:16 +08:00
* Replace unused `for` index with underscore * Use `items()` to directly unpack dictionary values * Merge duplicate blocks in conditional * Use `any()` instead of for loop * Format __init__.py
This commit is contained in:
@ -50,11 +50,10 @@ def get_oauth_router(
|
||||
scopes: List[str] = Query(None),
|
||||
):
|
||||
# Check that authentication_backend exists
|
||||
backend_exists = False
|
||||
for backend in authenticator.backends:
|
||||
if backend.name == authentication_backend:
|
||||
backend_exists = True
|
||||
break
|
||||
backend_exists = any(
|
||||
backend.name == authentication_backend for backend in authenticator.backends
|
||||
)
|
||||
|
||||
if not backend_exists:
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
Reference in New Issue
Block a user