安全修复和管理员账号密码自定义

This commit is contained in:
2025-12-13 12:37:18 +08:00
parent 7d924bb81e
commit 4606407356
5 changed files with 24 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
"""
Authentication Router
"""
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi import APIRouter, Depends, HTTPException, status, Request
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from datetime import timedelta
@@ -66,6 +66,7 @@ async def register(
@router.post("/login", response_model=Token)
@limiter.limit("5/minute")
async def login(
request: Request,
user_data: UserLogin,
db: AsyncSession = Depends(get_db)
):

View File

@@ -1,7 +1,7 @@
"""
Exam Router - Handles exam creation, file upload, and deduplication
"""
from fastapi import APIRouter, Depends, HTTPException, status, UploadFile, File, Form, BackgroundTasks
from fastapi import APIRouter, Depends, HTTPException, status, UploadFile, File, Form, BackgroundTasks, Request
from fastapi.responses import StreamingResponse
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select, func, and_
@@ -537,6 +537,7 @@ async def async_parse_and_save(
@router.post("/create", response_model=ExamUploadResponse, status_code=status.HTTP_201_CREATED)
@limiter.limit("10/minute")
async def create_exam_with_upload(
request: Request,
background_tasks: BackgroundTasks,
title: str = Form(...),
file: UploadFile = File(...),
@@ -587,6 +588,7 @@ async def create_exam_with_upload(
@router.post("/{exam_id}/append", response_model=ExamUploadResponse)
@limiter.limit("10/minute")
async def append_document_to_exam(
request: Request,
exam_id: int,
background_tasks: BackgroundTasks,
file: UploadFile = File(...),