🔒️ more secure token generation

This commit is contained in:
naiba
2022-12-16 23:34:14 +08:00
parent c027ae1396
commit 8ae885874b
10 changed files with 65 additions and 58 deletions

View File

@@ -1,14 +1,11 @@
package model
import (
"fmt"
"time"
"code.gitea.io/sdk/gitea"
"github.com/google/go-github/v47/github"
"github.com/xanzy/go-gitlab"
"github.com/naiba/nezha/pkg/utils"
)
type User struct {
@@ -72,8 +69,3 @@ func NewUserFromGitHub(gu *github.User) User {
u.Bio = gu.GetBio()
return u
}
func (u *User) IssueNewToken() {
u.Token = utils.MD5(fmt.Sprintf("%d%d%s", time.Now().UnixNano(), u.ID, u.Login))
u.TokenExpired = time.Now().AddDate(0, 2, 0)
}