@@ -18,18 +18,12 @@ func JWTAuth(required bool) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if required == true {
|
||||
if required == true && uid == "" {
|
||||
c.JSON(401, gin.H{"status": "unauthorized"})
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
if uid == "" {
|
||||
c.Set("user_id", "")
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("user_id", uid)
|
||||
c.Next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user