diff --git a/.env.example b/.env.example index 8e54ef5..f25c9ab 100644 --- a/.env.example +++ b/.env.example @@ -22,7 +22,7 @@ INLINE_WORKERS=2 # ---------- 鉴权与账号 ---------- AUTH_ENABLED=true BOOTSTRAP_USERNAME=admin -BOOTSTRAP_PASSWORD=admin1234 # 库里首个管理员,登录后请立刻改口令 +BOOTSTRAP_PASSWORD=admin@123 # 库里首个管理员,登录后请立刻改口令 # ---------- 调度节奏 / 重试 / 断点续跑 ---------- DISPATCH_INTERVAL_SECONDS=5 diff --git a/backend/app/config.py b/backend/app/config.py index 52a8dec..797d8f3 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -74,7 +74,7 @@ class Settings(BaseSettings): password_iterations: int = 180_000 bootstrap_username: str = "admin" bootstrap_display_name: str = "平台管理员" - bootstrap_password: str = "admin1234" # 仅首次播种时使用,登录后强制改密 + bootstrap_password: str = "admin@123" # 仅首次播种时使用,登录后强制改密 # ---- 任务执行后端 ---- # celery = 生产模式(Redis broker + worker) diff --git a/backend/tests/test_auth.py b/backend/tests/test_auth.py index 97d564f..7258732 100644 --- a/backend/tests/test_auth.py +++ b/backend/tests/test_auth.py @@ -13,12 +13,13 @@ from app.db import SessionLocal from app.models import EventLog, User, UserSession from app.services import auth as auth_service -ADMIN = {"username": "admin", "password": "admin1234"} +# 口令不写死:播种用的是 settings.bootstrap_password,写死第二遍迟早对不上 +ADMIN = {"username": settings.bootstrap_username, "password": settings.bootstrap_password} @pytest.fixture def secured(client, monkeypatch): - """开启鉴权后的 TestClient(lifespan 已播种 admin/admin1234)。""" + """开启鉴权后的 TestClient(lifespan 已播种 settings 里那个初始管理员)。""" monkeypatch.setattr(settings, "auth_enabled", True) return client diff --git a/docker-compose.yml b/docker-compose.yml index 7ed5f38..8aea60d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: INLINE_WORKERS: "${INLINE_WORKERS:-2}" AUTH_ENABLED: "${AUTH_ENABLED:-true}" BOOTSTRAP_USERNAME: "${BOOTSTRAP_USERNAME:-admin}" - BOOTSTRAP_PASSWORD: "${BOOTSTRAP_PASSWORD:-admin1234}" + BOOTSTRAP_PASSWORD: "${BOOTSTRAP_PASSWORD:-admin@123}" AUTO_SEED: "${AUTO_SEED:-only-missing}" # 首启用 scripts/seed 灌模型配置:only-missing|force|off TZ: "${TZ:-Asia/Shanghai}" ports: