check post csrf3

This commit is contained in:
SBD
2024-01-12 16:11:35 +03:00
parent 9a88243323
commit 4ad3813499
2 changed files with 13 additions and 1 deletions

View File

@@ -157,6 +157,18 @@ function checkStateCookie () {
}
}
function getCsrfCookie () {
let str = window.document.cookie
str = str.split('; ');
let obj_cookie = {}
for (let i = 0;i < str.length;i++){
let cur = str[i].split('=');
obj_cookie[cur[0]] = cur[1]
}
let csrf = obj_cookie['csrftoken']
return csrf
}
function setCokie () {
let date = new Date();
let days = 182;

View File

@@ -26,7 +26,7 @@ function select_tab_profile (el,url,owner_type=null) {
}
$.ajax({
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
headers: { "X-CSRFToken": "{{csrf_token}}" },
headers: { "X-CSRFToken": `${getCsrfCookie()}` },
url: confirm_url,
type: "POST",
// async: true,