fix: restore soft-deleted users on login

This commit is contained in:
2026-06-15 07:36:13 +08:00
parent 04d30f9dd1
commit 346cf0e4a6
13 changed files with 234 additions and 37 deletions
+3 -6
View File
@@ -122,12 +122,9 @@ func GitHubOAuth(c *gin.Context) {
})
return
}
// if user.Id == 0 , user has been deleted
if user.Id == 0 {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "用户已注销",
})
if err := user.RestoreIfDeleted("github", c.ClientIP()); err != nil {
common.SysError(fmt.Sprintf("failed to restore user %d: %v", user.Id, err))
common.ApiError(c, err)
return
}
} else {