Skip to content

Commit

Permalink
The method reading from the form has been improved
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaszQr committed Mar 28, 2018
1 parent 8834d25 commit abd5b14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ CsrfMagic.end = function () {
forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
form = forms[i];
if (form.getAttribute('method').toUpperCase() !== 'POST') continue;
var method = form.getAttribute('method');
if (method && method.toUpperCase() !== 'POST') continue;
if (form.elements[csrfMagicName]) continue;
var input = document.createElement('input');
input.setAttribute('name', csrfMagicName);
Expand Down
2 changes: 1 addition & 1 deletion src/Csrf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abd5b14

Please sign in to comment.