diff --git a/js/csrfprotector.js b/js/csrfprotector.js index c637208..729de8e 100644 --- a/js/csrfprotector.js +++ b/js/csrfprotector.js @@ -231,14 +231,16 @@ function csrfprotector_init() { */ function new_send(data) { if (this.method.toLowerCase() === 'post') { - - if (typeof data !== undefined) { - data += "&"; + if (data !== null && typeof data === 'object') { + data.append(CSRFP.CSRFP_TOKEN, CSRFP._getAuthKey()); } else { - data = ""; + if (data !== "") { + data += "&"; + } else { + data = ""; + } + data += CSRFP.CSRFP_TOKEN +"=" +CSRFP._getAuthKey(); } - - data += "csrfp_token=" +CSRFP._getAuthKey(); } return this.old_send(data); } @@ -288,4 +290,4 @@ function csrfprotector_init() { }); } -} \ No newline at end of file +}