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