Add CSRF check for task and project files upload

This commit is contained in:
Frédéric Guillot
2018-01-29 15:56:30 -08:00
parent 90984d6bb9
commit 9ddefa979a
13 changed files with 71 additions and 13 deletions

View File

@@ -83,9 +83,10 @@ KB.http.postForm = function (url, formElement) {
return (new KB.http.request('POST', url, {}, formData)).execute();
};
KB.http.uploadFile = function (url, file, onProgress, onComplete, onError, onServerError) {
KB.http.uploadFile = function (url, file, csrf, onProgress, onComplete, onError, onServerError) {
var fd = new FormData();
fd.append('files[]', file);
fd.append('csrf_token', csrf);
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', onProgress);