From 744d166f58a448065bf0f6374d2ec31721edc9ff Mon Sep 17 00:00:00 2001 From: jekkos Date: Wed, 28 Dec 2016 18:12:54 +0100 Subject: [PATCH] Hook standard jquery submit function and update csrf (#1019) --- application/views/partial/header_js.php | 7 +++++++ application/views/receivings/receiving.php | 2 -- application/views/sales/register.php | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/views/partial/header_js.php b/application/views/partial/header_js.php index 212a0b54d..027026944 100644 --- a/application/views/partial/header_js.php +++ b/application/views/partial/header_js.php @@ -44,6 +44,13 @@ } }); + var submit = $.fn.submit; + + $.fn.submit = function() { + setup_csrf_token(); + submit.apply(this, arguments); + }; + session_sha1 = 'session->userdata('session_sha1'); ?>'; diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index 1ddd6ed72..fd3a9fef3 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -414,7 +414,6 @@ $(document).ready(function() autoFocus: false, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -424,7 +423,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; } diff --git a/application/views/sales/register.php b/application/views/sales/register.php index ffb50debe..50cede8c7 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -527,7 +527,6 @@ $(document).ready(function() delay: 500, select: function (a, ui) { $(this).val(ui.item.value); - setup_csrf_token(); $("#add_item_form").submit(); return false; } @@ -537,7 +536,6 @@ $(document).ready(function() $('#item').keypress(function (e) { if (e.which == 13) { - setup_csrf_token(); $('#add_item_form').submit(); return false; }