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:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user