summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/base/tool.go4
-rw-r--r--modules/middleware/auth.go2
-rw-r--r--modules/template/template.go2
-rw-r--r--routers/user/auth.go2
-rw-r--r--routers/user/setting.go2
-rw-r--r--templates/base/head.tmpl4
-rw-r--r--templates/status/404.tmpl2
-rw-r--r--templates/status/500.tmpl2
8 files changed, 10 insertions, 10 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 78983b3611..b1d945117c 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 4b9531571b..078bdfdc5b 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 37c7d79351..c408ac8a26 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 {
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 24ed3673e8..3f37b09059 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -70,7 +70,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
if form.Remember {
days := 86400 * setting.LogInRememberDays
ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl)
- ctx.SetSuperSecureCookie(base.EncodeMd5(u.Rands+u.Passwd),
+ ctx.SetSuperSecureCookie(base.EncodeMD5(u.Rands+u.Passwd),
setting.CookieRememberName, u.Name, days, setting.AppSubUrl)
}
diff --git a/routers/user/setting.go b/routers/user/setting.go
index 53b7fdf929..2e825cf56f 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -79,7 +79,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
ctx.User.Email = form.Email
ctx.User.Website = form.Website
ctx.User.Location = form.Location
- ctx.User.Avatar = base.EncodeMd5(form.Gravatar)
+ ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
ctx.User.AvatarEmail = form.Gravatar
if err := models.UpdateUser(ctx.User); err != nil {
ctx.Handle(500, "UpdateUser", err)
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 171e6fde01..d5513280a0 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -21,11 +21,11 @@
<!-- Stylesheet -->
<link rel="stylesheet" href="{{AppSubUrl}}/css/semantic-2.1.6.min.css">
- <link rel="stylesheet" href="{{AppSubUrl}}/css/gogs.css?v={{AppVer}}">
+ <link rel="stylesheet" href="{{AppSubUrl}}/css/gogs.css?v={{MD5 AppVer}}">
<!-- JavaScript -->
<script src="{{AppSubUrl}}/js/semantic-2.1.6.min.js"></script>
- <script src="{{AppSubUrl}}/js/gogs.js?v={{AppVer}}"></script>
+ <script src="{{AppSubUrl}}/js/gogs.js?v={{MD5 AppVer}}"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
</head>
diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl
index b9874c5f17..a1b632df2a 100644
--- a/templates/status/404.tmpl
+++ b/templates/status/404.tmpl
@@ -3,7 +3,7 @@
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p>
<div class="ui divider"></div>
<br>
- <p>Application Version: {{AppVer}}</p>
+ {{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
</div>
{{template "base/footer" .}}
diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl
index ac2b4be71f..519a6f60f6 100644
--- a/templates/status/500.tmpl
+++ b/templates/status/500.tmpl
@@ -4,6 +4,6 @@
<div class="ui divider"></div>
<br>
{{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}}
- <p>Application Version: {{AppVer}}</p>
+ {{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}
</div>
{{template "base/footer" .}}