summaryrefslogtreecommitdiffstats
path: root/modules/base/tool.go
diff options
context:
space:
mode:
authorMatthias Loibl <mail@matthiasloibl.com>2016-11-06 01:53:11 +0100
committerMatthias Loibl <mail@matthiasloibl.com>2016-11-07 23:29:41 +0100
commit11c9160cd32934bc94e3c8bbfaeded577b1ebccb (patch)
tree5dd3656f95580c331818d5dc0dc1e93a464e8b5a /modules/base/tool.go
parent864d1b1f9f6a72589d77ec0f08b21c476b8e13d4 (diff)
downloadgitea-11c9160cd32934bc94e3c8bbfaeded577b1ebccb.tar.gz
gitea-11c9160cd32934bc94e3c8bbfaeded577b1ebccb.zip
Start to add tests for modules/base/tool
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r--modules/base/tool.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 8cc90c0b9a..987e651985 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -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,