mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
add csrf token header to all resource-modifying xhr
This commit is contained in:
parent
20bb9fe42f
commit
ce3ec131a6
@ -162,6 +162,15 @@ function setupBtns() {
|
||||
});
|
||||
}
|
||||
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
var csrfToken = $('meta[name=csrf_token]').attr('content');
|
||||
if (/^(POST|PATCH|PUT|DELETE)$/i.test(settings.type)) {
|
||||
xhr.setRequestHeader("X-CSRF-Token", csrfToken);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$().ready(function(){
|
||||
csrf = $('#csrf_token').val();
|
||||
pageCurrent = window.location.href.split("?")[1].split("=")[1];
|
||||
|
Loading…
Reference in New Issue
Block a user