소스 검색

fix: only return necessary information to frontend

JustSong 2 년 전
부모
커밋
420223caca
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 3
      controller/user.go

+ 8 - 3
controller/user.go

@@ -74,12 +74,17 @@ func setupLogin(user *model.User, c *gin.Context) {
 		})
 		return
 	}
-	user.Password = ""
-	user.Token = ""
+	cleanUser := model.User{
+		Id:          user.Id,
+		Username:    user.Username,
+		DisplayName: user.DisplayName,
+		Role:        user.Role,
+		Status:      user.Status,
+	}
 	c.JSON(http.StatusOK, gin.H{
 		"message": "",
 		"success": true,
-		"data":    user,
+		"data":    cleanUser,
 	})
 }