feat: add account locking and rate limit

This commit is contained in:
2026-01-06 22:02:58 +08:00
parent 105029a9f4
commit 9295e7c7be
7 changed files with 180 additions and 2 deletions
+4
View File
@@ -11,6 +11,7 @@ from backend.config import settings
from backend.models import init_db
from backend.exceptions import BaseAPIException
from backend.schemas.response import ErrorResponse, ErrorDetail
from backend.limiter import limiter
# 配置日志
settings.LOG_FILE.parent.mkdir(parents=True, exist_ok=True)
@@ -64,6 +65,9 @@ app = FastAPI(
lifespan=lifespan,
)
# 绑定速率限制器到应用
app.state.limiter = limiter
# 配置 CORS
app.add_middleware(
CORSMiddleware,