From ea48c19c8ad613ab6e1c081e93fb2224a8cb8125 Mon Sep 17 00:00:00 2001 From: alessio giacobbe Date: Tue, 29 Jun 2021 20:53:20 +0200 Subject: [PATCH] Re-assigning forms actions this is needed if submit actions are redefined otherwise createHiddenInputElement() will not be called on submit --- js/csrfprotector.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/csrfprotector.js b/js/csrfprotector.js index ac58c55..1d5c81b 100644 --- a/js/csrfprotector.js +++ b/js/csrfprotector.js @@ -232,6 +232,16 @@ function csrfprotector_init() { } } } + + //reassign every form functions + for (let form of document.forms){ + form.submit = HTMLFormElement.prototype.submit + form.submit_real = HTMLFormElement.prototype.submit_real + form.attachEvent = HTMLFormElement.prototype.attachEvent + form.attachEvent_real = HTMLFormElement.prototype.attachEvent_real + form.addEventListener = HTMLFormElement.prototype.addEventListener + form.addEventListener_real = HTMLFormElement.prototype.addEventListener_real + } //================================================================== // Wrapper for XMLHttpRequest & ActiveXObject (for IE 6 & below)