Adapt frontend for CSRF in import dialog
This commit is contained in:
parent
91cead27f8
commit
f7177e670d
@ -37,6 +37,26 @@ var Refine = {
|
||||
actionAreas: []
|
||||
};
|
||||
|
||||
Refine.wrapCSRF = function(onCSRF) {
|
||||
$.get(
|
||||
"command/core/get-csrf-token",
|
||||
{},
|
||||
function(response) {
|
||||
onCSRF(response['token']);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
};
|
||||
|
||||
Refine.postCSRF = function(url, data, success, dataType) {
|
||||
Refine.wrapCSRF(function(token) {
|
||||
var fullData = data || {};
|
||||
data['csrf_token'] = token;
|
||||
$.post(url, fulldata, success, dataType);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var lang = (navigator.language|| navigator.userLanguage).split("-")[0];
|
||||
var dictionary = "";
|
||||
$.ajax({
|
||||
|
@ -187,7 +187,7 @@ Refine.DefaultImportingController.prototype._ensureFormatParserUIHasInitializati
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "core/default-importing-controller",
|
||||
"jobID": this._jobID,
|
||||
"jobID": self._jobID,
|
||||
"subCommand": "initialize-parser-ui",
|
||||
"format": format,
|
||||
"csrf_token": token
|
||||
@ -219,12 +219,12 @@ Refine.DefaultImportingController.prototype.updateFormatAndOptions = function(op
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "core/default-importing-controller",
|
||||
"jobID": this._jobID,
|
||||
"jobID": self._jobID,
|
||||
"subCommand": "update-format-and-options",
|
||||
"csrf_token": token
|
||||
}),
|
||||
{
|
||||
"format" : this._format,
|
||||
"format" : self._format,
|
||||
"options" : JSON.stringify(options)
|
||||
},
|
||||
function(o) {
|
||||
@ -297,12 +297,12 @@ Refine.DefaultImportingController.prototype._createProject = function() {
|
||||
$.post(
|
||||
"command/core/importing-controller?" + $.param({
|
||||
"controller": "core/default-importing-controller",
|
||||
"jobID": this._jobID,
|
||||
"jobID": self._jobID,
|
||||
"subCommand": "create-project",
|
||||
"csrf_token": token
|
||||
}),
|
||||
{
|
||||
"format" : this._format,
|
||||
"format" : self._format,
|
||||
"options" : JSON.stringify(options)
|
||||
},
|
||||
function(o) {
|
||||
|
Loading…
Reference in New Issue
Block a user