Fix: skip Turnstile when no token provided (IP access before DNS)
This commit is contained in:
parent
29772fa1e4
commit
de5ad23763
|
|
@ -66,8 +66,8 @@ func (h *AdminHandler) AdminLogin(c *gin.Context) {
|
||||||
}
|
}
|
||||||
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
|
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
|
||||||
|
|
||||||
// Verify Turnstile token (invisible mode)
|
// Verify Turnstile token (invisible mode) — only if both secret and token are present
|
||||||
if h.turnstileSecret != "" {
|
if h.turnstileSecret != "" && req.TurnstileToken != "" {
|
||||||
turnstileService := services.NewTurnstileService(h.turnstileSecret)
|
turnstileService := services.NewTurnstileService(h.turnstileSecret)
|
||||||
remoteIP := c.ClientIP()
|
remoteIP := c.ClientIP()
|
||||||
turnstileResp, err := turnstileService.VerifyToken(req.TurnstileToken, remoteIP)
|
turnstileResp, err := turnstileService.VerifyToken(req.TurnstileToken, remoteIP)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue