diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/migrations/v71.go | 4 | ||||
-rw-r--r-- | models/migrations/v85.go | 4 | ||||
-rw-r--r-- | models/token.go | 4 | ||||
-rw-r--r-- | models/twofactor.go | 6 | ||||
-rw-r--r-- | models/user.go | 3 |
5 files changed, 10 insertions, 11 deletions
diff --git a/models/migrations/v71.go b/models/migrations/v71.go index 3012dd94f5..e4ed46a21a 100644 --- a/models/migrations/v71.go +++ b/models/migrations/v71.go @@ -8,8 +8,8 @@ import ( "crypto/sha256" "fmt" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "golang.org/x/crypto/pbkdf2" "xorm.io/xorm" @@ -53,7 +53,7 @@ func addScratchHash(x *xorm.Engine) error { for _, tfa := range tfas { // generate salt - salt, err := generate.GetRandomString(10) + salt, err := util.RandomString(10) if err != nil { return err } diff --git a/models/migrations/v85.go b/models/migrations/v85.go index 8c92f10b6e..bdbcebeb00 100644 --- a/models/migrations/v85.go +++ b/models/migrations/v85.go @@ -7,9 +7,9 @@ package migrations import ( "fmt" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/xorm" ) @@ -65,7 +65,7 @@ func hashAppToken(x *xorm.Engine) error { for _, token := range tokens { // generate salt - salt, err := generate.GetRandomString(10) + salt, err := util.RandomString(10) if err != nil { return err } diff --git a/models/token.go b/models/token.go index 1245098df0..4737dddda3 100644 --- a/models/token.go +++ b/models/token.go @@ -10,8 +10,8 @@ import ( "time" "code.gitea.io/gitea/modules/base" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" gouuid "github.com/google/uuid" ) @@ -40,7 +40,7 @@ func (t *AccessToken) AfterLoad() { // NewAccessToken creates new access token. func NewAccessToken(t *AccessToken) error { - salt, err := generate.GetRandomString(10) + salt, err := util.RandomString(10) if err != nil { return err } diff --git a/models/twofactor.go b/models/twofactor.go index a84da8cdb5..c19c5d120f 100644 --- a/models/twofactor.go +++ b/models/twofactor.go @@ -11,10 +11,10 @@ import ( "encoding/base64" "fmt" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/secret" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "github.com/pquerna/otp/totp" "golang.org/x/crypto/pbkdf2" @@ -34,11 +34,11 @@ type TwoFactor struct { // GenerateScratchToken recreates the scratch token the user is using. func (t *TwoFactor) GenerateScratchToken() (string, error) { - token, err := generate.GetRandomString(8) + token, err := util.RandomString(8) if err != nil { return "", err } - t.ScratchSalt, _ = generate.GetRandomString(10) + t.ScratchSalt, _ = util.RandomString(10) t.ScratchHash = hashToken(token, t.ScratchSalt) return token, nil } diff --git a/models/user.go b/models/user.go index 26cfc0804e..02ccfea47f 100644 --- a/models/user.go +++ b/models/user.go @@ -22,7 +22,6 @@ import ( "unicode/utf8" "code.gitea.io/gitea/modules/base" - "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -746,7 +745,7 @@ func IsUserExist(uid int64, name string) (bool, error) { // GetUserSalt returns a random user salt token. func GetUserSalt() (string, error) { - return generate.GetRandomString(10) + return util.RandomString(10) } // NewGhostUser creates and returns a fake user for someone has deleted his/her account. |