From c4df0faa5a2eaa0fb0bae9fbe858e9f423425c9f Mon Sep 17 00:00:00 2001 From: pg9182 <96569817+pg9182@users.noreply.github.com> Date: Mon, 24 Oct 2022 05:40:39 -0400 Subject: cmd/atlas-import: Better auth token expiry logic --- cmd/atlas-import/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/atlas-import') diff --git a/cmd/atlas-import/main.go b/cmd/atlas-import/main.go index 24e2d81..5068b83 100644 --- a/cmd/atlas-import/main.go +++ b/cmd/atlas-import/main.go @@ -148,8 +148,8 @@ func insertA(n *nsacct, a *atlasdb.DB) error { fmt.Fprintf(os.Stderr, "warning: uid %d (%s): failed to parse last auth ip %q (%v), ignoring\n", n.ID, n.Username, *n.LastAuthIP, err) } } - x.AuthToken = n.CurrentAuthToken - if v := time.Unix(n.CurrentAuthTokenExpirationTime, 0); time.Now().Before(v.Add(time.Hour * -24)) { + if v := time.Unix(n.CurrentAuthTokenExpirationTime/1000, 0); time.Until(v).Abs() < time.Hour*24 { + x.AuthToken = n.CurrentAuthToken x.AuthTokenExpiry = v } if n.CurrentServerID != nil && *n.CurrentServerID != "" { -- cgit v1.2.3