fix #2020
This commit is contained in:
parent
56c66ee486
commit
7f9598141b
8 changed files with 10 additions and 10 deletions
|
@ -31,8 +31,8 @@ import (
|
||||||
|
|
||||||
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code")
|
var Sanitizer = bluemonday.UGCPolicy().AllowAttrs("class").Matching(regexp.MustCompile(`[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&]*`)).OnElements("code")
|
||||||
|
|
||||||
// Encode string to md5 hex value.
|
// EncodeMD5 encodes string to md5 hex value.
|
||||||
func EncodeMd5(str string) string {
|
func EncodeMD5(str string) string {
|
||||||
m := md5.New()
|
m := md5.New()
|
||||||
m.Write([]byte(str))
|
m.Write([]byte(str))
|
||||||
return hex.EncodeToString(m.Sum(nil))
|
return hex.EncodeToString(m.Sum(nil))
|
||||||
|
|
|
@ -54,7 +54,7 @@ func AutoSignIn(ctx *Context) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if val, _ := ctx.GetSuperSecureCookie(
|
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
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ var Funcs template.FuncMap = map[string]interface{}{
|
||||||
"DiffLineTypeToStr": DiffLineTypeToStr,
|
"DiffLineTypeToStr": DiffLineTypeToStr,
|
||||||
"Sha1": Sha1,
|
"Sha1": Sha1,
|
||||||
"ShortSha": base.ShortSha,
|
"ShortSha": base.ShortSha,
|
||||||
"Md5": base.EncodeMd5,
|
"MD5": base.EncodeMD5,
|
||||||
"ActionContent2Commits": ActionContent2Commits,
|
"ActionContent2Commits": ActionContent2Commits,
|
||||||
"ToUtf8": ToUtf8,
|
"ToUtf8": ToUtf8,
|
||||||
"EscapePound": func(str string) string {
|
"EscapePound": func(str string) string {
|
||||||
|
|
|
@ -70,7 +70,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
|
||||||
if form.Remember {
|
if form.Remember {
|
||||||
days := 86400 * setting.LogInRememberDays
|
days := 86400 * setting.LogInRememberDays
|
||||||
ctx.SetCookie(setting.CookieUserName, u.Name, days, setting.AppSubUrl)
|
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)
|
setting.CookieRememberName, u.Name, days, setting.AppSubUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
||||||
ctx.User.Email = form.Email
|
ctx.User.Email = form.Email
|
||||||
ctx.User.Website = form.Website
|
ctx.User.Website = form.Website
|
||||||
ctx.User.Location = form.Location
|
ctx.User.Location = form.Location
|
||||||
ctx.User.Avatar = base.EncodeMd5(form.Gravatar)
|
ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
|
||||||
ctx.User.AvatarEmail = form.Gravatar
|
ctx.User.AvatarEmail = form.Gravatar
|
||||||
if err := models.UpdateUser(ctx.User); err != nil {
|
if err := models.UpdateUser(ctx.User); err != nil {
|
||||||
ctx.Handle(500, "UpdateUser", err)
|
ctx.Handle(500, "UpdateUser", err)
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
<!-- Stylesheet -->
|
<!-- Stylesheet -->
|
||||||
<link rel="stylesheet" href="{{AppSubUrl}}/css/semantic-2.1.6.min.css">
|
<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 -->
|
<!-- JavaScript -->
|
||||||
<script src="{{AppSubUrl}}/js/semantic-2.1.6.min.js"></script>
|
<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>
|
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p>
|
<p style="margin-top: 100px"><img src="{{AppSubUrl}}/img/404.png" alt="404"/></p>
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<br>
|
<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>
|
<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>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "base/footer" .}}
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<br>
|
<br>
|
||||||
{{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}}
|
{{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}}
|
||||||
<p>Application Version: {{AppVer}}</p>
|
{{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "base/footer" .}}
|
||||||
|
|
Loading…
Reference in a new issue