Fix. .htpasswd did not take into account absolute paths

This commit is contained in:
tanshu 2020-05-04 16:54:38 +05:30
parent ae806542e3
commit 2eb906fae8
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,6 @@ import os
from crypt import crypt
from functools import lru_cache
import pkg_resources
from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPBasic, HTTPBasicCredentials
@ -17,7 +16,8 @@ def get_settings():
def validate(username: str, password: str, settings: config.Settings):
file = pkg_resources.resource_filename("bifrost", "../" + settings.htpasswd)
here = os.path.abspath(os.path.dirname(__file__))
file = os.path.join(here, '../', settings.htpasswd)
if not os.path.isfile(file):
return None
users = {}