mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Enable create group repo
This commit is contained in:
@@ -130,6 +130,29 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
prepareApiCsrf: function() {
|
||||
/* alias away the sync method */
|
||||
Backbone._sync = Backbone.sync;
|
||||
|
||||
/* define a new sync method */
|
||||
Backbone.sync = function(method, model, options) {
|
||||
|
||||
/* only need a token for non-get requests */
|
||||
if (method == 'create' || method == 'update' || method == 'delete') {
|
||||
// CSRF token value is in an embedded meta tag
|
||||
// var csrfToken = $("meta[name='csrf_token']").attr('content');
|
||||
var csrfToken = app.pageOptions.csrfToken;
|
||||
|
||||
options.beforeSend = function(xhr){
|
||||
xhr.setRequestHeader('X-CSRFToken', csrfToken);
|
||||
};
|
||||
}
|
||||
|
||||
/* proxy the call to the old sync method */
|
||||
return Backbone._sync(method, model, options);
|
||||
};
|
||||
},
|
||||
|
||||
prepareCSRFToken: function(xhr, settings) {
|
||||
function getCookie(name) {
|
||||
var cookieValue = null;
|
||||
|
Reference in New Issue
Block a user