From e0fc779f58db71e5ad82f28f173732716d69c6df Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Thu, 2 Mar 2023 16:19:31 +0100 Subject: [PATCH] add id to the PAT --- management/server/personal_access_token.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/management/server/personal_access_token.go b/management/server/personal_access_token.go index 16ab232e4..07f621aa9 100644 --- a/management/server/personal_access_token.go +++ b/management/server/personal_access_token.go @@ -8,9 +8,11 @@ import ( "time" "codeberg.org/ac/base62" + "github.com/rs/xid" ) type PersonalAccessToken struct { + ID string Description string HashedToken [32]byte ExpirationDate time.Time @@ -38,6 +40,7 @@ func CreateNewPAT(description string, expirationInDays int, createdBy User) (*Pe hashedToken, plainToken := generateNewToken() currentTime := time.Now().UTC() return &PersonalAccessToken{ + ID: xid.New().String(), Description: description, HashedToken: hashedToken, ExpirationDate: currentTime.AddDate(0, 0, expirationInDays),