Fix XSS, CSRF, input validation, and related security issues
This commit is contained in:
@@ -349,6 +349,18 @@
|
||||
navigator.serviceWorker.register('/sw.js');
|
||||
}
|
||||
|
||||
// Inject CSRF token into all POST forms
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var token = '{{ csrf_token() }}';
|
||||
document.querySelectorAll('form').forEach(function(form) {
|
||||
if (form.method.toLowerCase() === 'post') {
|
||||
var inp = document.createElement('input');
|
||||
inp.type = 'hidden'; inp.name = 'csrf_token'; inp.value = token;
|
||||
form.appendChild(inp);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
(function() {
|
||||
var modal = document.getElementById('confirm-modal');
|
||||
var msgEl = document.getElementById('confirm-modal-msg');
|
||||
|
||||
Reference in New Issue
Block a user