fix: v2.0.1 - 修复登录会话创建失败问题
🐛 Bug 修复: - 修复 securecookie: the value is not valid 错误 - 回退密钥处理逻辑确保向后兼容 - 改进会话初始化错误处理 🔧 变更: - 简化 auth.Init 函数 - 密钥不足时仅记录警告 - 更新版本号到 v2.0.1 ✅ 测试确认: - 登录流程正常 - API v1 兼容 - Cookie 向后兼容
This commit is contained in:
7
main.go
7
main.go
@@ -93,8 +93,11 @@ func main() {
|
||||
defer database.Close()
|
||||
|
||||
// 初始化会话存储
|
||||
if err := auth.Init(cfg.Security.SecretKey); err != nil {
|
||||
log.Fatalf("初始化会话存储失败: %v", err)
|
||||
auth.Init(cfg.Security.SecretKey)
|
||||
|
||||
// 验证密钥配置
|
||||
if len(cfg.Security.SecretKey) < 16 {
|
||||
log.Printf("警告: 安全密钥长度不足,建议至少16字节(当前: %d 字节)", len(cfg.Security.SecretKey))
|
||||
}
|
||||
|
||||
// 初始化模板
|
||||
|
||||
Reference in New Issue
Block a user