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'];
|
||||
|
||||
require(['csrf'], function(csrf) {
|
||||
csrf.set(config.csrf_token);
|
||||
});
|
||||
|
||||
bootbox.setDefaults({
|
||||
locale: config.userLang
|
||||
});
|
||||
@@ -88,17 +84,15 @@ app.cacheBuster = null;
|
||||
};
|
||||
|
||||
app.logout = function() {
|
||||
require(['csrf'], function(csrf) {
|
||||
$.ajax(config.relative_path + '/logout', {
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'x-csrf-token': csrf.get()
|
||||
'x-csrf-token': config.csrf_token
|
||||
},
|
||||
success: function() {
|
||||
window.location.href = config.relative_path + '/';
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
app.alert = function (params) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/*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 = {};
|
||||
|
||||
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,
|
||||
method: 'delete',
|
||||
headers: {
|
||||
'x-csrf-token': csrf.get()
|
||||
'x-csrf-token': config.csrf_token
|
||||
}
|
||||
}).done(function() {
|
||||
parentEl.remove();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/* global define, app, config, RELATIVE_PATH */
|
||||
|
||||
define('forum/login', ['csrf', 'translator'], function(csrf, translator) {
|
||||
define('forum/login', ['translator'], function(translator) {
|
||||
var Login = {};
|
||||
|
||||
Login.init = function() {
|
||||
@@ -25,7 +25,7 @@ define('forum/login', ['csrf', 'translator'], function(csrf, translator) {
|
||||
submitEl.addClass('disabled');
|
||||
formEl.ajaxSubmit({
|
||||
headers: {
|
||||
'x-csrf-token': csrf.get()
|
||||
'x-csrf-token': config.csrf_token
|
||||
},
|
||||
success: function(data, status) {
|
||||
window.location.href = data + '?loggedin';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* globals define, app, utils, socket, config, ajaxify, bootbox */
|
||||
|
||||
|
||||
define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
||||
define('forum/register', ['translator'], function(translator) {
|
||||
var Register = {},
|
||||
validationError = false,
|
||||
successIcon = '<i class="fa fa-check"></i>';
|
||||
@@ -78,7 +78,7 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
||||
|
||||
registerBtn.parents('form').ajaxSubmit({
|
||||
headers: {
|
||||
'x-csrf-token': csrf.get()
|
||||
'x-csrf-token': config.csrf_token
|
||||
},
|
||||
success: function(data) {
|
||||
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 */
|
||||
|
||||
define('uploader', ['csrf', 'translator'], function(csrf, translator) {
|
||||
define('uploader', ['translator'], function(translator) {
|
||||
|
||||
var module = {};
|
||||
|
||||
@@ -76,7 +76,7 @@ define('uploader', ['csrf', 'translator'], function(csrf, translator) {
|
||||
|
||||
uploadModal.find('#uploadForm').ajaxSubmit({
|
||||
headers: {
|
||||
'x-csrf-token': csrf.get()
|
||||
'x-csrf-token': config.csrf_token
|
||||
},
|
||||
error: function(xhr) {
|
||||
xhr = maybeParse(xhr);
|
||||
|
||||
@@ -61,7 +61,6 @@ module.exports = function(Meta) {
|
||||
'public/src/client/category.js',
|
||||
'public/src/client/categoryTools.js',
|
||||
|
||||
'public/src/modules/csrf.js',
|
||||
'public/src/modules/translator.js',
|
||||
'public/src/modules/notifications.js',
|
||||
'public/src/modules/chat.js',
|
||||
|
||||
Reference in New Issue
Block a user