From 778b1e70142c5f5345aa5cc683385ace2dfa47bb Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 15 Feb 2017 22:17:20 +0100 Subject: parse request token from head element directly --- js/app/Config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/app/Config.js b/js/app/Config.js index 830093351..2152615c6 100644 --- a/js/app/Config.js +++ b/js/app/Config.js @@ -33,12 +33,14 @@ app.config(function ($routeProvider, $provide, $httpProvider) { $provide.factory('CSRFInterceptor', function ($q, BASE_URL, $window) { return { request: function (config) { - var domain = + const token = $window.document.getElementsByTagName('head')[0] + .getAttribute('data-requesttoken'); + const domain = $window.location.href.split($window.location.pathname)[0]; if (config.url.indexOf(BASE_URL) === 0 || config.url.indexOf(domain) === 0) { /*jshint camelcase: false */ - config.headers.requesttoken = oc_requesttoken; + config.headers.requesttoken = token; } return config || $q.when(config); -- cgit v1.2.3