feat: 多用户管理系统,管理员可分配用户

- 新增 users 数据库表,存储用户名、密码哈希、角色
- 启动时自动从 .env 创建初始管理员账号
- 登录改为数据库校验,不再硬编码比对
- 新增 /api/users 管理接口(仅管理员)
- ConfigView 新增用户管理页(创建、改密码、切换角色、删除)
This commit is contained in:
shen
2026-06-08 21:08:16 +08:00
parent 1cecf66d94
commit 48fdca12bd
6 changed files with 327 additions and 10 deletions
+2 -1
View File
@@ -7,7 +7,7 @@ from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from .database import init_db
from .routers import config, apps, tasks, auth
from .routers import config, apps, tasks, auth, users
from .services.log_streamer import log_streamer
from .config import BACKEND_PORT
@@ -38,6 +38,7 @@ app.add_middleware(
# 路由
app.include_router(auth.router)
app.include_router(users.router)
app.include_router(config.router)
app.include_router(apps.router)
app.include_router(tasks.router)