diff options
author | silverwind <me@silverwind.io> | 2021-05-10 08:45:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-10 07:45:17 +0100 |
commit | 1e6fa57acbe3c05cb996b789e8c2d381c953826f (patch) | |
tree | c4f1ce55b3423f97952b630462cef5b2035961ec /models/user.go | |
parent | 270aab429ef025df9a0b9bf9e3982729ae8df449 (diff) | |
download | gitea-1e6fa57acbe3c05cb996b789e8c2d381c953826f.tar.gz gitea-1e6fa57acbe3c05cb996b789e8c2d381c953826f.zip |
Use single shared random string generation function (#15741)
* Use single shared random string generation function
- Replace 3 functions that do the same with 1 shared one
- Use crypto/rand over math/rand for a stronger RNG
- Output only alphanumerical for URL compatibilty
Fixes: #15536
* use const string method
* Update modules/avatar/avatar.go
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 3 |
1 files changed, 1 insertions, 2 deletions
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. |