diff options
author | Codruț Constantin Gușoi <codrut.gusoi@gmail.com> | 2018-02-18 18:14:37 +0000 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-02-18 20:14:37 +0200 |
commit | 96c268c0fcc22604103f67821d66fef39944e80b (patch) | |
tree | fb5a97ff8557ae18dd22b227e52fcd811320eac3 /models | |
parent | e59fe7c8d9eb8e49858cb2d59e8732f6058756ff (diff) | |
download | gitea-96c268c0fcc22604103f67821d66fef39944e80b.tar.gz gitea-96c268c0fcc22604103f67821d66fef39944e80b.zip |
Implements generator cli for secrets (#3531)
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/migrations/migrations.go | 6 | ||||
-rw-r--r-- | models/twofactor.go | 4 | ||||
-rw-r--r-- | models/user.go | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 23235f7819..d79d403712 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -20,7 +20,7 @@ import ( gouuid "github.com/satori/go.uuid" "gopkg.in/ini.v1" - "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" ) @@ -539,10 +539,10 @@ func generateOrgRandsAndSalt(x *xorm.Engine) (err error) { } for _, org := range orgs { - if org.Rands, err = base.GetRandomString(10); err != nil { + if org.Rands, err = generate.GetRandomString(10); err != nil { return err } - if org.Salt, err = base.GetRandomString(10); err != nil { + if org.Salt, err = generate.GetRandomString(10); err != nil { return err } if _, err = sess.Id(org.ID).Update(org); err != nil { diff --git a/models/twofactor.go b/models/twofactor.go index 526ab917e8..789315021e 100644 --- a/models/twofactor.go +++ b/models/twofactor.go @@ -16,7 +16,7 @@ import ( "github.com/pquerna/otp/totp" - "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" ) @@ -33,7 +33,7 @@ type TwoFactor struct { // GenerateScratchToken recreates the scratch token the user is using. func (t *TwoFactor) GenerateScratchToken() error { - token, err := base.GetRandomString(8) + token, err := generate.GetRandomString(8) if err != nil { return err } diff --git a/models/user.go b/models/user.go index 57abfc1965..fa41deec92 100644 --- a/models/user.go +++ b/models/user.go @@ -34,6 +34,7 @@ import ( "code.gitea.io/gitea/modules/avatar" "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/generate" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" @@ -638,7 +639,7 @@ func IsUserExist(uid int64, name string) (bool, error) { // GetUserSalt returns a random user salt token. func GetUserSalt() (string, error) { - return base.GetRandomString(10) + return generate.GetRandomString(10) } // NewGhostUser creates and returns a fake user for someone has deleted his/her account. |