Skip to content

Commit 7e10c1d

Browse files
authored
Merge pull request #1371 from symfony/autocomplete-off
[stimulus-bundle] Use defaultValue to change the value of hidden CSRF fields
2 parents d061eb3 + b14ca06 commit 7e10c1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

symfony/stimulus-bundle/2.20/assets/controllers/csrf_protection_controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ document.addEventListener('submit', function (event) {
1414

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

2020
if (csrfCookie && tokenCheck.test(csrfToken)) {

0 commit comments

Comments
 (0)