mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-05 00:50:21 +00:00
chore: back comp
This commit is contained in:
1 parent
cd69af3a0a
commit
245103615f
1 file changed
+11
-2
@@ -60,8 +60,17 @@ func payloadFunc() func(data any) jwt.MapClaims {
|
|||||||
func identityHandler() func(c *gin.Context) any {
|
func identityHandler() func(c *gin.Context) any {
|
||||||
return func(c *gin.Context) any {
|
return func(c *gin.Context) any {
|
||||||
claims := jwt.ExtractClaims(c)
|
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)
|
currentIP := c.GetString(model.CtxKeyRealIPStr)
|
||||||
|
|
||||||
if tokenIP != currentIP {
|
if tokenIP != currentIP {
|
||||||
|
|||||||
Reference in new issue
Block a user