fix http basic requiring
All checks were successful
Build and Publish / build_and_publish (push) Successful in 22s
All checks were successful
Build and Publish / build_and_publish (push) Successful in 22s
This commit is contained in:
parent
918c797df4
commit
29838b7046
1 changed files with 5 additions and 1 deletions
|
@ -65,8 +65,12 @@ async def lifespan(_app: FastAPI):
|
|||
)
|
||||
yield
|
||||
|
||||
httpbasic = HTTPBasic(auto_error=False)
|
||||
|
||||
async def has_account(req: Request, credentials: HTTPBasicCredentials = Depends(HTTPBasic())) -> db.Account | None:
|
||||
|
||||
async def has_account(req: Request, credentials: HTTPBasicCredentials | None = Depends(httpbasic)) -> db.Account | None:
|
||||
if os.getenv("ALLOW_ANONYMOUS", "true") == "true" and not credentials:
|
||||
return
|
||||
account = await db.Account.get_or_none(username=credentials.username)
|
||||
if account is None:
|
||||
if os.getenv("ALLOW_ANONYMOUS", "true") == "true":
|
||||
|
|
Loading…
Reference in a new issue