mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-24 00:58:37 -04:00
Revert CSRF change (#2009)
This commit is contained in:
1 parent
5ce7fcf5ed
commit
2e7e9cecd8
6 files changed
+31
-42
No files matched your search
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user