Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Revert "Hopefully patch exploit that allows anyone to log users out"

This reverts commit b0a3555afe.
Cette révision appartient à :
PantsuDev 2017-06-04 21:19:23 +10:00
Parent 77760b3067
révision 93af9a7df4
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: C0A42175139840D6

Voir le fichier

@ -12,9 +12,9 @@ import (
"github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/crypto"
"github.com/NyaaPantsu/nyaa/util/publicSettings"
msg "github.com/NyaaPantsu/nyaa/util/messages"
"github.com/NyaaPantsu/nyaa/util/modelHelper"
"github.com/NyaaPantsu/nyaa/util/publicSettings"
"github.com/gorilla/mux"
)
@ -293,17 +293,9 @@ func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
// UserLogoutHandler : Controller to logout users
func UserLogoutHandler(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
vars := mux.Vars(r)
id := vars["id"]
currentUser := getUser(r)
messages := msg.GetMessages(r)
userProfile, _, errorUser := userService.RetrieveUserForAdmin(id)
if userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
_, _ = userService.ClearCookie(w)
url, _ := Router.Get("home").URL()
http.Redirect(w, r, url.String(), http.StatusSeeOther)
}
messages.ImportFromError("errors", errorUser)
_, _ = userService.ClearCookie(w)
url, _ := Router.Get("home").URL()
http.Redirect(w, r, url.String(), http.StatusSeeOther)
}
// UserFollowHandler : Controller to follow/unfollow users, need user id to follow