From 7f9598141bd7b0200d9342f01243228eab3061ba Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 24 Nov 2015 18:49:34 -0500 Subject: fix #2020 --- modules/base/tool.go | 4 ++-- modules/middleware/auth.go | 2 +- modules/template/template.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/base/tool.go b/modules/base/tool.go index 78983b36..b1d94511 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -31,8 +31,8 @@ import ( var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code") -// Encode string to md5 hex value. -func EncodeMd5(str string) string { +// EncodeMD5 encodes string to md5 hex value. +func EncodeMD5(str string) string { m := md5.New() m.Write([]byte(str)) return hex.EncodeToString(m.Sum(nil)) diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 4b953157..078bdfdc 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -54,7 +54,7 @@ func AutoSignIn(ctx *Context) (bool, error) { } if val, _ := ctx.GetSuperSecureCookie( - base.EncodeMd5(u.Rands+u.Passwd), setting.CookieRememberName); val != u.Name { + base.EncodeMD5(u.Rands+u.Passwd), setting.CookieRememberName); val != u.Name { return false, nil } diff --git a/modules/template/template.go b/modules/template/template.go index 37c7d793..c408ac8a 100644 --- a/modules/template/template.go +++ b/modules/template/template.go @@ -88,7 +88,7 @@ var Funcs template.FuncMap = map[string]interface{}{ "DiffLineTypeToStr": DiffLineTypeToStr, "Sha1": Sha1, "ShortSha": base.ShortSha, - "Md5": base.EncodeMd5, + "MD5": base.EncodeMD5, "ActionContent2Commits": ActionContent2Commits, "ToUtf8": ToUtf8, "EscapePound": func(str string) string { -- cgit v1.2.3