summaryrefslogtreecommitdiffstats
path: root/models/asymkey
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-12-28 11:09:57 +0100
committerGitHub <noreply@github.com>2023-12-28 11:09:57 +0100
commite743570f65b533552337d9606ac1d906ec054127 (patch)
tree55042505c0618b567e7f30e7334ec6d66db86230 /models/asymkey
parentRefactor some legacy code and remove unused code (#28622) (diff)
downloadforgejo-e743570f65b533552337d9606ac1d906ec054127.tar.xz
forgejo-e743570f65b533552337d9606ac1d906ec054127.zip
Refactor timeutil package (#28623)
1. make names more readable 2. remove unused FormatLong/FormatShort 3. use `FormatDate` instead of `Format "2006-01-02"`
Diffstat (limited to 'models/asymkey')
-rw-r--r--models/asymkey/gpg_key_verify.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/models/asymkey/gpg_key_verify.go b/models/asymkey/gpg_key_verify.go
index be36482c74..98a3e7d390 100644
--- a/models/asymkey/gpg_key_verify.go
+++ b/models/asymkey/gpg_key_verify.go
@@ -107,8 +107,9 @@ func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature st
// VerificationToken returns token for the user that will be valid in minutes (time)
func VerificationToken(user *user_model.User, minutes int) string {
return base.EncodeSha256(
- time.Now().Truncate(1*time.Minute).Add(time.Duration(minutes)*time.Minute).Format(time.RFC1123Z) + ":" +
- user.CreatedUnix.FormatLong() + ":" +
+ time.Now().Truncate(1*time.Minute).Add(time.Duration(minutes)*time.Minute).Format(
+ time.RFC1123Z) + ":" +
+ user.CreatedUnix.Format(time.RFC1123Z) + ":" +
user.Name + ":" +
user.Email + ":" +
strconv.FormatInt(user.ID, 10))