Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Views/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ final public function renderContent($viewIndex = null)

if ($this->model->isRootLeaf && !$this->model->suppressContainingForm) {
$csrfProtector = CsrfProtection::singleton();
$content .= '<input type="hidden" name="' . CsrfProtection::TOKEN_COOKIE_NAME . '" value="' . htmlentities($csrfProtector->getCookie()) . '" />';
$content .= '<input type="hidden" class="js-' . CsrfProtection::TOKEN_COOKIE_NAME . '" name="' . CsrfProtection::TOKEN_COOKIE_NAME . '" value="' . htmlentities($csrfProtector->getCookie()) . '" />';
}

if ($this->requiresContainerDiv) {
Expand Down
6 changes: 6 additions & 0 deletions src/Views/ViewBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,12 @@ ViewBridge.prototype.sendFileAsServerEvent = function (eventName, file, onProgre
formData.append("_leafEventleafPath", hostPresenter.leafPath);
}

var csrfTokenElements = this.eventHost.viewNode.parentElement.getElementsByClassName('js-csrf_tk');
if (csrfTokenElements.length > 0) {
var csrfToken = csrfTokenElements[0].value;
formData.append('csrf_tk', csrfToken);
}

formData.append(this.leafPath, file);

// Add all hidden State inputs on the page to ensure event processing can
Expand Down