Skip to content

Commit

Permalink
fix: CheckAuth in GetChargingRecord()
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn committed Aug 29, 2023
1 parent 601ddcb commit 5aa5625
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions backend/WebUI/api_webui.go
Original file line number Diff line number Diff line change
Expand Up @@ -1941,14 +1941,9 @@ func parseCDR(supi string) map[int64]RatingGroupDataUsage {
func GetChargingRecord(c *gin.Context) {
setCorsHeader(c)

if tokenStr := c.GetHeader("Token"); tokenStr != "admin" {
if _, err := ParseJWT(tokenStr); err != nil {
logger.ProcLog.Errorln(err.Error())
c.JSON(http.StatusBadRequest, gin.H{
"cause": "Illegal Token",
})
return
}
if !CheckAuth(c) {
c.JSON(http.StatusUnauthorized, gin.H{"cause": "Illegal Token"})
return
}

webuiSelf := webui_context.GetSelf()
Expand Down

0 comments on commit 5aa5625

Please sign in to comment.