From 56097d5629a65781c8a1b42aa70e426b43e9fc53 Mon Sep 17 00:00:00 2001 From: glaszig Date: Wed, 7 Aug 2019 23:53:04 +0200 Subject: [PATCH] send proper csrf header --- includes/csrf.php | 3 --- index.php | 1 + js/custom.js | 9 --------- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/includes/csrf.php b/includes/csrf.php index 7cfc1302..1977dca4 100644 --- a/includes/csrf.php +++ b/includes/csrf.php @@ -6,6 +6,3 @@ include_once('session.php'); if (csrfValidateRequest() && !CSRFValidate()) { handleInvalidCSRFToken(); } - -ensureCSRFSessionToken(); -header('X-CSRF-Token', $_SESSION['csrf_token']); diff --git a/index.php b/index.php index d797587a..b0816c37 100755 --- a/index.php +++ b/index.php @@ -19,6 +19,7 @@ */ require('includes/csrf.php'); +ensureCSRFSessionToken(); include_once('includes/config.php'); include_once(RASPI_CONFIG.'/raspap.php'); diff --git a/js/custom.js b/js/custom.js index 01c355cf..ac1ec75b 100644 --- a/js/custom.js +++ b/js/custom.js @@ -167,14 +167,6 @@ function setCSRFTokenHeader(event, xhr, settings) { } } -function updateCSRFTokens(event, xhr, settings) { - var newToken = xhr.getResponseHeader("X-CSRF-Token"); - if (newToken) { - $('meta[name=csrf_token]').attr('content', newToken); - $('[name=csrf_token]:input').attr('value', newToken); - } -} - function contentLoaded() { pageCurrent = window.location.href.split("?")[1].split("=")[1]; pageCurrent = pageCurrent.replace("#",""); @@ -190,5 +182,4 @@ function contentLoaded() { $(document) .ajaxSend(setCSRFTokenHeader) - .ajaxComplete(updateCSRFTokens) .ready(contentLoaded);