aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/resource/steps
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2018-11-28 13:38:45 -0500
committerParker Berberian <pberberian@iol.unh.edu>2018-11-28 13:38:45 -0500
commit1bca75075deaa0922946194173def8e4cf6fb985 (patch)
tree69ea70e75c34ba75e408b05b39a510749abbee75 /src/templates/resource/steps
parentb361d6df77ab59bb0f227aec00c19b080f31bc50 (diff)
Removed Vanilla Form Submission
On google chrome, using vanilla html forms, eg: document.getElementById("Form_id").submit(); does not properly set the CSRF header from the cookies. This results in 403 unauthorized errors in chrome when doing certain things. This is possibly an issue to do with how chrome handles iframes differently from firefox. To fix, we replaced basic forms with serialized XMLHttpRequests, which are more common in this codebase anyway. Change-Id: I93e92cd326c8bba47408b66a95d9d5d806c154f6 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/templates/resource/steps')
-rw-r--r--src/templates/resource/steps/meta_info.html8
-rw-r--r--src/templates/resource/steps/pod_definition.html1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/templates/resource/steps/meta_info.html b/src/templates/resource/steps/meta_info.html
index 389ff6d..b458842 100644
--- a/src/templates/resource/steps/meta_info.html
+++ b/src/templates/resource/steps/meta_info.html
@@ -14,5 +14,11 @@
{% endblock content %}
{% block onleave %}
-document.getElementById("resource_meta_form").submit();
+var ajaxForm = $("#resource_meta_form");
+var formData = ajaxForm.serialize();
+req = new XMLHttpRequest();
+req.open("POST", "/wf/workflow/", false);
+req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+req.onerror = function() { alert("problem submitting form"); }
+req.send(formData);
{% endblock %}
diff --git a/src/templates/resource/steps/pod_definition.html b/src/templates/resource/steps/pod_definition.html
index ab9dfb3..b2b4998 100644
--- a/src/templates/resource/steps/pod_definition.html
+++ b/src/templates/resource/steps/pod_definition.html
@@ -596,7 +596,6 @@ function submitForm() {
var input_elem = document.getElementById("hidden_xml_input");
var s = encodeGraph(currentGraph);
input_elem.value = s;
- //form.submit();
req = new XMLHttpRequest();
req.open("POST", "/wf/workflow/", false);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");