repaired session alive check

This commit is contained in:
Lars Hoogestraat 2018-12-20 15:45:44 +01:00
parent 3929c923ba
commit 2074a217f2
4 changed files with 5 additions and 4 deletions

View File

@ -53,6 +53,8 @@ func (fn TemplateHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
successMsg = t.SuccessMsg
warnMsg = t.WarnMsg
t.Data["CSRFToken"] = csrf.Token(r)
if t.Err != nil {
switch e := t.Err.(type) {

View File

@ -155,7 +155,7 @@ func restrictedRoutes(ctx *m.AppContext, router *mux.Router, chain alice.Chain)
router.Handle("/logout", chain.Then(useTemplateHandler(ctx, c.LogoutHandler))).Methods("GET")
router.Handle("/json/session/keep-alive", chain.Then(useJSONHandler(ctx, c.KeepAliveSessionHandler))).Methods("GET")
router.Handle("/json/session/keep-alive", chain.Then(useJSONHandler(ctx, c.KeepAliveSessionHandler))).Methods("POST")
router.Handle("/json/file/upload", chain.Then(useJSONHandler(ctx, c.AdminUploadJSONFilePostHandler))).Methods("POST")
}

View File

@ -73,9 +73,8 @@
{
method: 'POST',
headers: {
"X-CSRF-Token": csrf.value
"X-CSRF-Token": document.head.querySelector("[name=csrfToken]").content,
},
body: formData
})
};

View File

@ -4,8 +4,8 @@
<html{{if Language}} lang="{{Language}}"{{end}}>
<head>
<meta charset="UTF-8">
<meta name="csrfToken" content="{{.CSRFToken}}">
<title>{{PageTitle}} | Administration</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="/assets/css/master.css">
<link rel="icon" href="/favicon.ico" type="image/vnd.microsoft.icon">
</head>