1
0
Fork 0
forked from forgejo/forgejo

Start to add tests for modules/base/tool

This commit is contained in:
Matthias Loibl 2016-11-06 01:53:11 +01:00
parent 864d1b1f9f
commit 11c9160cd3
No known key found for this signature in database
GPG key ID: B1C7DF661ABB2C1A
2 changed files with 85 additions and 7 deletions

View file

@ -23,11 +23,9 @@ import (
"github.com/Unknwon/com"
"github.com/Unknwon/i18n"
"github.com/gogits/chardet"
"github.com/go-gitea/gitea/modules/log"
"github.com/go-gitea/gitea/modules/setting"
"github.com/gogits/chardet"
)
// EncodeMD5 encodes string to md5 hex value.
@ -198,10 +196,7 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
// HashEmail hashes email address to MD5 string.
// https://en.gravatar.com/site/implement/hash/
func HashEmail(email string) string {
email = strings.ToLower(strings.TrimSpace(email))
h := md5.New()
h.Write([]byte(email))
return hex.EncodeToString(h.Sum(nil))
return EncodeMD5(strings.ToLower(strings.TrimSpace(email)))
}
// AvatarLink returns relative avatar link to the site domain by given email,