1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-16 18:16:24 -07:00

Fix edit post not letting non-privileged users edit their posts

This commit is contained in:
Eggbertx 2023-02-11 15:33:15 -08:00
parent 0ec36c2840
commit 46db3e0abc
3 changed files with 10 additions and 6 deletions

View file

@ -75,6 +75,7 @@ func editPost(checkedPosts []int, editBtn string, doEdit string, writer http.Res
"siteConfig": config.GetSiteConfig(),
"board": board,
"boardConfig": config.GetBoardConfig(""),
"password": password,
"post": post,
"referrer": request.Referer(),
}
@ -92,7 +93,6 @@ func editPost(checkedPosts []int, editBtn string, doEdit string, writer http.Res
writer.Write(buf.Bytes())
}
if doEdit == "post" || doEdit == "upload" {
var password string
postid, err := strconv.Atoi(request.FormValue("postid"))
if err != nil {
errEv.Err(err).Caller().
@ -122,7 +122,9 @@ func editPost(checkedPosts []int, editBtn string, doEdit string, writer http.Res
}
rank := manage.GetStaffRank(request)
if request.FormValue("password") != password && rank == 0 {
password := request.PostFormValue("password")
passwordMD5 := gcutil.Md5Sum(password)
if post.Password != passwordMD5 && rank == 0 {
server.ServeError(writer, "Wrong password", wantsJSON, nil)
return
}