fix: 拒绝过短密钥,并把对外端口只留在本机
This commit is contained in:
@@ -8,10 +8,11 @@ _backend = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(_backend))
|
||||
_root = _backend.parent / "Temp" / "pytest"
|
||||
_root.mkdir(parents=True, exist_ok=True)
|
||||
os.environ["EUNIV_SECRET_KEY"] = "test-secret-key"
|
||||
os.environ["EUNIV_SECRET_KEY"] = "test-secret-key-0123456789abcdef"
|
||||
os.environ["EUNIV_DB_PATH"] = str(_root / "euniv.db")
|
||||
os.environ["EUNIV_DISABLE_REFRESH"] = "1"
|
||||
os.environ["EUNIV_ADMIN_PASSWORD"] = "test-admin-pass"
|
||||
os.environ["EUNIV_COOKIE_SECURE"] = "0"
|
||||
os.environ.pop("EUNIV_ADMIN_RESET", None)
|
||||
|
||||
|
||||
@@ -19,7 +20,7 @@ os.environ.pop("EUNIV_ADMIN_RESET", None)
|
||||
def fresh_database():
|
||||
from sqlalchemy import text
|
||||
|
||||
from admin.settings import ensure_admin_seed, load_admin_identity
|
||||
from admin.settings import ensure_admin_seed, ensure_key_check, load_admin_identity
|
||||
from euniv.db import engine, init_db
|
||||
|
||||
with engine.begin() as connection:
|
||||
@@ -33,6 +34,7 @@ def fresh_database():
|
||||
connection.execute(text("DROP TABLE IF EXISTS alembic_version"))
|
||||
init_db()
|
||||
ensure_admin_seed()
|
||||
ensure_key_check()
|
||||
load_admin_identity()
|
||||
from admin.login_limit import reset
|
||||
|
||||
|
||||
Reference in New Issue
Block a user