API key change should take effect on restart only

This commit is contained in:
Jakob Borg
2014-06-05 09:16:12 +02:00
parent 20a018db2e
commit 1cff9ccc63
2 changed files with 4 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ func csrfMiddleware(w http.ResponseWriter, r *http.Request) {
if validAPIKey(r.Header.Get("X-API-Key")) {
return
}
if strings.HasPrefix(r.URL.Path, "/rest/") {
token := r.Header.Get("X-CSRF-Token")
if !validCsrfToken(token) {