mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-20 23:49:23 +00:00
fix #2020
This commit is contained in:
parent
56c66ee486
commit
7f9598141b
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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" .}}
|
||||
|
|
|
@ -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" .}}
|
||||
|
|
Loading…
Reference in a new issue