mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 08:40:20 +00:00
chore: back comp
This commit is contained in:
1 parent
3b8d2f3736
commit
fbfe28a54e
1 file changed
+11
-2
@@ -60,8 +60,17 @@ func payloadFunc() func(data any) jwt.MapClaims {
|
||||
func identityHandler() func(c *gin.Context) any {
|
||||
return func(c *gin.Context) any {
|
||||
claims := jwt.ExtractClaims(c)
|
||||
userId := claims["user_id"].(string)
|
||||
tokenIP := claims["ip"].(string)
|
||||
|
||||
userId, ok := claims["user_id"].(string)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
tokenIP, ok := claims["ip"].(string)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
currentIP := c.GetString(model.CtxKeyRealIPStr)
|
||||
|
||||
if tokenIP != currentIP {
|
||||
|
||||
Reference in new issue
Block a user