Fix. .htpasswd did not take into account absolute paths
This commit is contained in:
parent
ae806542e3
commit
2eb906fae8
@ -2,7 +2,6 @@ import os
|
|||||||
from crypt import crypt
|
from crypt import crypt
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
import pkg_resources
|
|
||||||
from fastapi import Depends, HTTPException, status
|
from fastapi import Depends, HTTPException, status
|
||||||
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||||||
|
|
||||||
@ -17,7 +16,8 @@ def get_settings():
|
|||||||
|
|
||||||
|
|
||||||
def validate(username: str, password: str, settings: config.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):
|
if not os.path.isfile(file):
|
||||||
return None
|
return None
|
||||||
users = {}
|
users = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user