This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
from fastapi import APIRouter, HTTPException
from app.schemas.captcha import CaptchaResponse, CaptchaVerifyRequest, CaptchaTokenResponse
from app.services.captcha import generate_slider_captcha, verify_slider_captcha
router = APIRouter(prefix="/captcha", tags=["captcha"])
@router.get("/slider", response_model=CaptchaResponse)
async def get_slider_captcha():
data = await generate_slider_captcha()
return data
@router.post("/verify", response_model=CaptchaTokenResponse)
async def verify_captcha(req: CaptchaVerifyRequest):
token = await verify_slider_captcha(req.captcha_id, req.x_offset)
if not token:
raise HTTPException(status_code=400, detail="验证失败,请重试")
return CaptchaTokenResponse(token=token)