|
@@ -8,6 +8,7 @@ import (
|
|
|
|
|
|
jwt "github.com/appleboy/gin-jwt/v2"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
+ "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
)
|
|
|
|
|
|
var identityKey = "id"
|
|
@@ -63,7 +64,9 @@ func NewUitlsJwt(app *conf.AppConf) *UtilsJwt {
|
|
|
|
|
|
Authorizator: func(data interface{}, _ *gin.Context) bool {
|
|
|
u := data.(*JWTUser)
|
|
|
- return len(u.ID) > 0
|
|
|
+ uid, _ := primitive.ObjectIDFromHex(u.ID)
|
|
|
+
|
|
|
+ return !uid.IsZero()
|
|
|
},
|
|
|
|
|
|
LoginResponse: func(c *gin.Context, status int, token string, expire time.Time) {
|