Skip to content

Commit

Permalink
QA: Fix issue with CSRF failing on no method passed
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWitness committed Nov 11, 2024
1 parent 069733b commit b94bf9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/vendor/csrf/csrf-magic.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ CsrfMagic.end = function() {
forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
form = forms[i];
if (form.method.toUpperCase() !== 'POST') continue;

if (typeof form.method.toUpperCase == 'function' && form.method.toUpperCase() !== 'POST') {
continue;
}

if (form.elements[csrfMagicName]) continue;
var input = document.createElement('input');
input.setAttribute('name', csrfMagicName);
Expand Down

0 comments on commit b94bf9c

Please sign in to comment.