@@ -15,11 +15,13 @@ func JWTAuth(required bool) gin.HandlerFunc {
|
|||||||
uid, err := token.HeaderVerify(auth)
|
uid, err := token.HeaderVerify(auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(401, gin.H{"status": err.Error()})
|
c.JSON(401, gin.H{"status": err.Error()})
|
||||||
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if required == true && uid == "" {
|
if required == true && uid == "" {
|
||||||
c.JSON(401, gin.H{"status": "unauthorized"})
|
c.JSON(401, gin.H{"status": "unauthorized"})
|
||||||
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user