Revert CSRF change (#2009)

This commit is contained in:
FrancescoUK committed 2018-06-06 21:28:52 +01:00
1 parent 5ce7fcf5ed
commit 2e7e9cecd8
6 files changed
+31 -42

No files matched your search

+5 -17
View File
@@ -16,6 +16,8 @@
from: '<?php echo $this->config->item('notify_vertical_position'); ?>'
}});
var post = $.post;
var csrf_token = function() {
return Cookies.get('<?php echo $this->config->item('csrf_cookie_name'); ?>');
};
@@ -24,23 +26,9 @@
return { <?php echo $this->security->get_csrf_token_name(); ?> : function () { return csrf_token(); } };
};
var ajax = $.ajax;
$.ajax = function() {
var args = arguments[0];
if (args['type'] && args['type'].toLowerCase() == 'post' && csrf_token()) {
if (typeof args['data'] === 'string')
{
args['data'] += $.param(csrf_form_base());
}
else
{
args['data'] = $.extend(args['data'], csrf_form_base());
}
}
return ajax.apply(this, arguments);
$.post = function() {
arguments[1] = csrf_token() ? $.extend(arguments[1], csrf_form_base()) : arguments[1];
post.apply(this, arguments);
};
var setup_csrf_token = function() {