Fix: skip Turnstile when no token provided (IP access before DNS)

This commit is contained in:
Patrick Britton 2026-02-06 10:29:55 -06:00
parent 29772fa1e4
commit de5ad23763

View file

@ -66,8 +66,8 @@ func (h *AdminHandler) AdminLogin(c *gin.Context) {
}
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
// Verify Turnstile token (invisible mode)
if h.turnstileSecret != "" {
// Verify Turnstile token (invisible mode) — only if both secret and token are present
if h.turnstileSecret != "" && req.TurnstileToken != "" {
turnstileService := services.NewTurnstileService(h.turnstileSecret)
remoteIP := c.ClientIP()
turnstileResp, err := turnstileService.VerifyToken(req.TurnstileToken, remoteIP)