diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index d5846b715..007c7a984 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -311,14 +311,27 @@ func (s *authServer) GetActiveDevices(ctx context.Context, req *pbauth.GetActive if err != nil { return nil, err } - for _, state := range m { - if state == constant.NormalToken { - devices = append(devices, &pbauth.DeviceInfo{ - PlatformID: int32(platformID), - PlatformName: platformName, - }) - break + var maxLoginUnix int64 + var hasNormal bool + for tokenStr, state := range m { + if state != constant.NormalToken { + continue } + hasNormal = true + claims, err := tokenverify.GetClaimFromToken(tokenStr, authverify.Secret(s.config.Share.Secret)) + if err != nil || claims.IssuedAt == nil { + continue + } + if u := claims.IssuedAt.Unix(); u > maxLoginUnix { + maxLoginUnix = u + } + } + if hasNormal { + devices = append(devices, &pbauth.DeviceInfo{ + PlatformID: int32(platformID), + PlatformName: platformName, + LoginTimeSeconds: maxLoginUnix, + }) } } return &pbauth.GetActiveDevicesResp{Devices: devices}, nil diff --git a/protocol b/protocol index 510b9a7dc..7bd25d802 160000 --- a/protocol +++ b/protocol @@ -1 +1 @@ -Subproject commit 510b9a7dc27703beab55334622e4ecf17b8a4d50 +Subproject commit 7bd25d8024043c6f8ebd4c6d473a89e7034e639d