mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
remove csrf r.js module
This commit is contained in:
@@ -15,10 +15,6 @@ app.cacheBuster = null;
|
|||||||
|
|
||||||
app.cacheBuster = config['cache-buster'];
|
app.cacheBuster = config['cache-buster'];
|
||||||
|
|
||||||
require(['csrf'], function(csrf) {
|
|
||||||
csrf.set(config.csrf_token);
|
|
||||||
});
|
|
||||||
|
|
||||||
bootbox.setDefaults({
|
bootbox.setDefaults({
|
||||||
locale: config.userLang
|
locale: config.userLang
|
||||||
});
|
});
|
||||||
@@ -88,16 +84,14 @@ app.cacheBuster = null;
|
|||||||
};
|
};
|
||||||
|
|
||||||
app.logout = function() {
|
app.logout = function() {
|
||||||
require(['csrf'], function(csrf) {
|
$.ajax(config.relative_path + '/logout', {
|
||||||
$.ajax(config.relative_path + '/logout', {
|
type: 'POST',
|
||||||
type: 'POST',
|
headers: {
|
||||||
headers: {
|
'x-csrf-token': config.csrf_token
|
||||||
'x-csrf-token': csrf.get()
|
},
|
||||||
},
|
success: function() {
|
||||||
success: function() {
|
window.location.href = config.relative_path + '/';
|
||||||
window.location.href = config.relative_path + '/';
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*global define, socket, app, ajaxify, config*/
|
/*global define, socket, app, ajaxify, config*/
|
||||||
|
|
||||||
define('forum/account/settings', ['forum/account/header', 'components', 'csrf'], function(header, components, csrf) {
|
define('forum/account/settings', ['forum/account/header', 'components'], function(header, components) {
|
||||||
var AccountSettings = {};
|
var AccountSettings = {};
|
||||||
|
|
||||||
AccountSettings.init = function() {
|
AccountSettings.init = function() {
|
||||||
@@ -99,7 +99,7 @@ define('forum/account/settings', ['forum/account/header', 'components', 'csrf'],
|
|||||||
url: config.relative_path + '/user/' + ajaxify.data.userslug + '/session/' + uuid,
|
url: config.relative_path + '/user/' + ajaxify.data.userslug + '/session/' + uuid,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrf.get()
|
'x-csrf-token': config.csrf_token
|
||||||
}
|
}
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
parentEl.remove();
|
parentEl.remove();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/* global define, app, config, RELATIVE_PATH */
|
/* global define, app, config, RELATIVE_PATH */
|
||||||
|
|
||||||
define('forum/login', ['csrf', 'translator'], function(csrf, translator) {
|
define('forum/login', ['translator'], function(translator) {
|
||||||
var Login = {};
|
var Login = {};
|
||||||
|
|
||||||
Login.init = function() {
|
Login.init = function() {
|
||||||
@@ -25,7 +25,7 @@ define('forum/login', ['csrf', 'translator'], function(csrf, translator) {
|
|||||||
submitEl.addClass('disabled');
|
submitEl.addClass('disabled');
|
||||||
formEl.ajaxSubmit({
|
formEl.ajaxSubmit({
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrf.get()
|
'x-csrf-token': config.csrf_token
|
||||||
},
|
},
|
||||||
success: function(data, status) {
|
success: function(data, status) {
|
||||||
window.location.href = data + '?loggedin';
|
window.location.href = data + '?loggedin';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/* globals define, app, utils, socket, config, ajaxify, bootbox */
|
/* globals define, app, utils, socket, config, ajaxify, bootbox */
|
||||||
|
|
||||||
|
|
||||||
define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
define('forum/register', ['translator'], function(translator) {
|
||||||
var Register = {},
|
var Register = {},
|
||||||
validationError = false,
|
validationError = false,
|
||||||
successIcon = '<i class="fa fa-check"></i>';
|
successIcon = '<i class="fa fa-check"></i>';
|
||||||
@@ -78,7 +78,7 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
|||||||
|
|
||||||
registerBtn.parents('form').ajaxSubmit({
|
registerBtn.parents('form').ajaxSubmit({
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrf.get()
|
'x-csrf-token': config.csrf_token
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
registerBtn.removeClass('disabled');
|
registerBtn.removeClass('disabled');
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*globals define*/
|
|
||||||
|
|
||||||
define('csrf', function() {
|
|
||||||
var csrf = {},
|
|
||||||
_data = {};
|
|
||||||
|
|
||||||
csrf.get = function() {
|
|
||||||
return _data.token;
|
|
||||||
};
|
|
||||||
|
|
||||||
csrf.set = function(token) {
|
|
||||||
_data.token = token;
|
|
||||||
};
|
|
||||||
|
|
||||||
return csrf;
|
|
||||||
});
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* globals define, templates */
|
/* globals define, templates */
|
||||||
|
|
||||||
define('uploader', ['csrf', 'translator'], function(csrf, translator) {
|
define('uploader', ['translator'], function(translator) {
|
||||||
|
|
||||||
var module = {};
|
var module = {};
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ define('uploader', ['csrf', 'translator'], function(csrf, translator) {
|
|||||||
|
|
||||||
uploadModal.find('#uploadForm').ajaxSubmit({
|
uploadModal.find('#uploadForm').ajaxSubmit({
|
||||||
headers: {
|
headers: {
|
||||||
'x-csrf-token': csrf.get()
|
'x-csrf-token': config.csrf_token
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
xhr = maybeParse(xhr);
|
xhr = maybeParse(xhr);
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ module.exports = function(Meta) {
|
|||||||
'public/src/client/category.js',
|
'public/src/client/category.js',
|
||||||
'public/src/client/categoryTools.js',
|
'public/src/client/categoryTools.js',
|
||||||
|
|
||||||
'public/src/modules/csrf.js',
|
|
||||||
'public/src/modules/translator.js',
|
'public/src/modules/translator.js',
|
||||||
'public/src/modules/notifications.js',
|
'public/src/modules/notifications.js',
|
||||||
'public/src/modules/chat.js',
|
'public/src/modules/chat.js',
|
||||||
@@ -93,7 +92,7 @@ module.exports = function(Meta) {
|
|||||||
var numBridged = 0,
|
var numBridged = 0,
|
||||||
addRoute = function(relPath) {
|
addRoute = function(relPath) {
|
||||||
var relativePath = nconf.get('relative_path');
|
var relativePath = nconf.get('relative_path');
|
||||||
|
|
||||||
app.get(relativePath + '/src/modules/' + relPath, function(req, res) {
|
app.get(relativePath + '/src/modules/' + relPath, function(req, res) {
|
||||||
return res.sendFile(path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]), {
|
return res.sendFile(path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]), {
|
||||||
maxAge: app.enabled('cache') ? 5184000000 : 0
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
||||||
|
|||||||
Reference in New Issue
Block a user