This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 1a0e24b69bea1095197d5acd41069fde04e028ba
Author: Carlos Cruz <[email protected]>
AuthorDate: Tue Jun 2 20:08:44 2026 +0000

    [#11645] Use jQuery cookie plugin to get CSRF token
---
 Allura/allura/public/nf/js/allura-base.js | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/Allura/allura/public/nf/js/allura-base.js 
b/Allura/allura/public/nf/js/allura-base.js
index a9109b549..4cdfdb081 100644
--- a/Allura/allura/public/nf/js/allura-base.js
+++ b/Allura/allura/public/nf/js/allura-base.js
@@ -18,18 +18,10 @@
 */
 
 (function($) {
-    if (!window.SF) {
-        window.SF = {};
-    }
-    if (window.SF.logoutLinkHandlerInstalled) {
+    if (window.logoutLinkHandlerInstalled) {
         return;
     }
-    window.SF.logoutLinkHandlerInstalled = true;
-
-    function getCookie(name) {
-        var match = document.cookie.match(new RegExp('(?:^|; )' + name + 
'=([^;]*)'));
-        return match ? decodeURIComponent(match[1]) : '';
-    }
+    window.logoutLinkHandlerInstalled = true;
 
     $(document).on('click', 'a[href]', function(e) {
         if (e.isDefaultPrevented() || e.which && e.which !== 1 || e.metaKey || 
e.ctrlKey || e.shiftKey || e.altKey) {
@@ -47,7 +39,7 @@
         e.preventDefault();
 
         var form = $('<form>', {method: 'post', action: '/auth/logout' + 
url.search});
-        form.append($('<input type="hidden" name="_csrf_token">').val($.cookie 
? $.cookie('_csrf_token') : getCookie('_csrf_token')));
+        form.append($('<input type="hidden" 
name="_csrf_token">').val($.cookie('_csrf_token')));
         $('body').append(form);
         form[0].submit();
         form.remove();

Reply via email to