移除验证码调试日志,增加cookie 工具

This commit is contained in:
2026-03-30 00:40:15 +08:00
parent fa84dca0b7
commit 16b4f0a0be
2 changed files with 15 additions and 1 deletions

View File

@@ -104,7 +104,6 @@ func VerifyCaptcha(c *gin.Context, captchaValue string) bool {
logrus.WithError(err).Warn("验证码验证失败无法从Cookie获取captcha_id") logrus.WithError(err).Warn("验证码验证失败无法从Cookie获取captcha_id")
return false return false
} }
logrus.Infof("VerifyCaptcha: received captchaId=%s, captchaValue=%s", captchaId, captchaValue)
// 先尝试原始值验证 // 先尝试原始值验证
if store.Verify(captchaId, captchaValue, false) { if store.Verify(captchaId, captchaValue, false) {

View File

@@ -2,6 +2,7 @@ package utils
import ( import (
"net/http" "net/http"
"strings"
"time" "time"
) )
@@ -9,6 +10,20 @@ import (
// Cookie创建函数 // Cookie创建函数
// ============================================================================ // ============================================================================
// FormatCookies formats a slice of cookies into a string suitable for HTTP headers
func FormatCookies(cookies []*http.Cookie) string {
var b strings.Builder
for i, c := range cookies {
if i > 0 {
b.WriteString("; ")
}
b.WriteString(c.Name)
b.WriteRune('=')
b.WriteString(c.Value)
}
return b.String()
}
// CreateSecureCookie 创建安全的Cookie // CreateSecureCookie 创建安全的Cookie
// name: Cookie名称 // name: Cookie名称
// value: Cookie值 // value: Cookie值