Skip to content

Commit

Permalink
[stimulus-bundle] Set autocomplete=off attribute using JS on hidden C…
Browse files Browse the repository at this point in the history
…SRF fields
  • Loading branch information
nicolas-grekas committed Dec 29, 2024
1 parent 5f3e6c5 commit 64e95d1
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ document.addEventListener('submit', function (event) {

if (!csrfCookie && nameCheck.test(csrfToken)) {
csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);
csrfField.setAttribute('autocomplete', 'off');
csrfField.value = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));
}

Expand Down

0 comments on commit 64e95d1

Please sign in to comment.