aboutsummaryrefslogtreecommitdiffstats
path: root/models/token.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/token.go')
-rw-r--r--models/token.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/token.go b/models/token.go
index b3712fce5e..44428a0809 100644
--- a/models/token.go
+++ b/models/token.go
@@ -10,8 +10,8 @@ import (
"fmt"
"time"
+ "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
- "code.gitea.io/gitea/models/login"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
@@ -68,7 +68,7 @@ func NewAccessToken(t *AccessToken) error {
}
t.TokenSalt = salt
t.Token = base.EncodeSha1(gouuid.New().String())
- t.TokenHash = login.HashToken(t.Token, t.TokenSalt)
+ t.TokenHash = auth.HashToken(t.Token, t.TokenSalt)
t.TokenLastEight = t.Token[len(t.Token)-8:]
_, err = db.GetEngine(db.DefaultContext).Insert(t)
return err
@@ -130,7 +130,7 @@ func GetAccessTokenBySHA(token string) (*AccessToken, error) {
}
for _, t := range tokens {
- tempHash := login.HashToken(token, t.TokenSalt)
+ tempHash := auth.HashToken(token, t.TokenSalt)
if subtle.ConstantTimeCompare([]byte(t.TokenHash), []byte(tempHash)) == 1 {
if successfulAccessTokenCache != nil {
successfulAccessTokenCache.Add(token, t.ID)