check post csrf3
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user