fix: coderabbit review

This commit is contained in:
Seefs
2025-08-03 10:41:00 +08:00
parent c784a70277
commit d85eeabf11
6 changed files with 25 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ func Setup2FA(c *gin.Context) {
})
return
}
// 如果存在已禁用的2FA记录先删除它
if existing != nil && !existing.IsEnabled {
if err := existing.Delete(); err != nil {
@@ -415,8 +415,14 @@ func Verify2FALogin(c *gin.Context) {
})
return
}
userId := pendingUserId.(int)
userId, ok := pendingUserId.(int)
if !ok {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "会话数据无效,请重新登录",
})
return
}
// 获取用户信息
user, err := model.GetUserById(userId, false)
if err != nil {