mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-05-06 05:38:50 +00:00
chore: back comp
This commit is contained in:
@@ -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