Skip to content
Permalink
Browse files

Merge pull request #72 from Diabol/JENKINS-23589-crumb-issue

JENKINS-23589 Send crumb if "Prevent Cross Site Request Forgery exploits" if enabled.
  • Loading branch information...
patbos committed Jul 1, 2014
2 parents 88f24ca + 5e7e73a commit ff39674516baed00bf0c071e00ec8324ed6b0b75
Showing with 19 additions and 2 deletions.
  1. +13 −2 src/main/webapp/pipe.js
  2. +6 −0 src/main/webapp/pipeline-common.css
@@ -302,16 +302,27 @@ function formatDuration(millis) {
function triggerManual(taskId, downstreamProject, upstreamProject, upstreamBuild) {
Q("#manual-" + taskId).hide();
var formData = {project: downstreamProject, upstream: upstreamProject, buildId: upstreamBuild};

var before;
if (crumb.value != "") {
console.info("Crumb found and will be added to request header");
before = function(xhr){xhr.setRequestHeader(crumb.fieldName, crumb.value);}
} else {
console.info("Crumb not needed");
before = function(xhr){}
}

Q.ajax({
url: view.apiBaseUrl + 'api/manualStep',
type: "POST",
data: formData,
beforeSend: before,
timeout: 20000,
success: function (data, textStatus, jqXHR) {
console.log("Triggered build!")
console.info("Triggered build of " + downstreamProject + " successfully!")
},
error: function (jqXHR, textStatus, errorThrown) {
window.alert("Could not trigger build!")
window.alert("Could not trigger build! error: " + errorThrown + " status: " + textStatus)
}
});
}
@@ -142,6 +142,7 @@ div.task-manual {
width: 14px;
float: right;
padding-right: 5px;
z-index: 100;
}

.timestamp {
@@ -252,6 +253,11 @@ div.button-start {

div.pipeline-message {
font-size: 15px;
z-index: -50;
}

._jsPlumb_connector {
z-index: -100;
}


0 comments on commit ff39674

Please sign in to comment.
You can’t perform that action at this time.