diff options
author | Joe Chen <jc@unknwon.io> | 2022-11-05 17:55:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 17:55:05 +0800 |
commit | fd798b4197dc53df872d20f5d10edb8d73c32386 (patch) | |
tree | e59c8e5881f2162e211850ede549a1f57df64515 /internal/userutil/userutil.go | |
parent | a66c90462da24a916ee62afcb5a1f79d06ed8399 (diff) |
refactor(db): migrate methods off `user.go` (#7228)
Diffstat (limited to 'internal/userutil/userutil.go')
-rw-r--r-- | internal/userutil/userutil.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/userutil/userutil.go b/internal/userutil/userutil.go index 6d324ff6..bafdaf58 100644 --- a/internal/userutil/userutil.go +++ b/internal/userutil/userutil.go @@ -23,6 +23,7 @@ import ( "gogs.io/gogs/internal/avatar" "gogs.io/gogs/internal/conf" + "gogs.io/gogs/internal/strutil" "gogs.io/gogs/internal/tool" ) @@ -132,3 +133,9 @@ func MailResendCacheKey(userID int64) string { func TwoFactorCacheKey(userID int64, passcode string) string { return fmt.Sprintf("twoFactor::%d::%s", userID, passcode) } + +// RandomSalt returns randomly generated 10-character string that can be used as +// the user salt. +func RandomSalt() (string, error) { + return strutil.RandomChars(10) +} |