feat(auth): add user captcha generation endpoint

- Add handler for /v1/auth/captcha/generate endpoint
- Implement captcha generation logic based on configuration
- Support local image captcha generation with Redis storage
- Return Turnstile site key for Turnstile mode
- Check EnableUserLoginCaptcha configuration
This commit is contained in:
EUForest
2026-03-09 22:54:47 +08:00
parent 5727708bbd
commit 2afb86f973
2 changed files with 88 additions and 0 deletions
@@ -0,0 +1,18 @@
package auth
import (
"github.com/gin-gonic/gin"
"github.com/perfect-panel/server/internal/logic/auth"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/pkg/result"
)
// Generate captcha
func GenerateCaptchaHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
return func(c *gin.Context) {
l := auth.NewGenerateCaptchaLogic(c.Request.Context(), svcCtx)
resp, err := l.GenerateCaptcha()
result.HttpResult(c, resp, err)
}
}