diff --git a/internal/frontend/assets/html/userInfo.html b/internal/frontend/assets/html/userInfo.html index ad558b91c..49186a3b1 100644 --- a/internal/frontend/assets/html/userInfo.html +++ b/internal/frontend/assets/html/userInfo.html @@ -122,7 +122,11 @@ {{$k}} {{range $v.AsSlice}} + {{if eq $k "exp" "iat" "updated_at"}} +

{{formatTime .}}

+ {{else}}

{{.}}

+ {{end}} {{end}} diff --git a/internal/frontend/templates.go b/internal/frontend/templates.go index 0f6719075..00a373339 100644 --- a/internal/frontend/templates.go +++ b/internal/frontend/templates.go @@ -65,7 +65,20 @@ func NewTemplates() (*template.Template, error) { "dataURL": func(p string) template.URL { return dataURLs[strings.TrimPrefix(p, "/.pomerium/assets/")] }, - "formatTime": func(tm time.Time) string { + "formatTime": func(arg interface{}) string { + var tm time.Time + switch t := arg.(type) { + case float64: + tm = time.Unix(int64(t), 0) + case int: + tm = time.Unix(int64(t), 0) + case int64: + tm = time.Unix(t, 0) + case time.Time: + tm = t + default: + return "" + } return tm.Format("2006-01-02 15:04:05 MST") }, })