]> source.dussan.org Git - archiva.git/commitdiff
[MRM-2022] Switching from beforeSend to ajax handler for header setting
authorMartin Stockhammer <martin_s@apache.org>
Fri, 17 Dec 2021 19:18:24 +0000 (20:18 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 17 Dec 2021 19:18:24 +0000 (20:18 +0100)
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js

index c047c2da87a7ec41a716ddaa9b1b130681bc1fce..3f021af7ebb1f8aa1482e40315a2b87ae0e5a580 100644 (file)
@@ -860,17 +860,15 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
     return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
   };
 
-  addValidationTokenHeader=function(user) {
-    if(user) {
+  addValidationTokenHeader = function (user) {
+    if (user) {
       if (user.validationToken) {
-        $.log("Adding validation token "+user.validationToken);
-        $.ajaxSetup({
-                      beforeSend: function (xhr) {
-                        xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
-                      }
-                    });
+        $.log("Adding validation token " + user.validationToken);
+        $(document).ajaxSend(function (ev, xhr, settings) {
+          xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
+        });
       } else {
-        $.log("No validation token in user object "+user.username+", "+user.validationToken);
+        $.log("No validation token in user object " + user.username + ", " + user.validationToken);
       }
     }
   };