mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #7115
This commit is contained in:
@@ -57,7 +57,7 @@ apiController.loadConfig = function (req, callback) {
|
|||||||
config.requireEmailConfirmation = meta.config.requireEmailConfirmation === 1;
|
config.requireEmailConfirmation = meta.config.requireEmailConfirmation === 1;
|
||||||
config.topicPostSort = meta.config.topicPostSort || 'oldest_to_newest';
|
config.topicPostSort = meta.config.topicPostSort || 'oldest_to_newest';
|
||||||
config.categoryTopicSort = meta.config.categoryTopicSort || 'newest_to_oldest';
|
config.categoryTopicSort = meta.config.categoryTopicSort || 'newest_to_oldest';
|
||||||
config.csrf_token = req.csrfToken && req.csrfToken();
|
config.csrf_token = !req.isSpider() && req.csrfToken && req.csrfToken();
|
||||||
config.searchEnabled = plugins.hasListeners('filter:search.query');
|
config.searchEnabled = plugins.hasListeners('filter:search.query');
|
||||||
config.bootswatchSkin = meta.config.bootswatchSkin || '';
|
config.bootswatchSkin = meta.config.bootswatchSkin || '';
|
||||||
config.enablePostHistory = (meta.config.enablePostHistory || 1) === 1;
|
config.enablePostHistory = (meta.config.enablePostHistory || 1) === 1;
|
||||||
|
|||||||
@@ -32,7 +32,15 @@ middleware.regexes = {
|
|||||||
timestampedUpload: /^\d+-.+$/,
|
timestampedUpload: /^\d+-.+$/,
|
||||||
};
|
};
|
||||||
|
|
||||||
middleware.applyCSRF = csrf();
|
const csrfMiddleware = csrf();
|
||||||
|
|
||||||
|
middleware.applyCSRF = function(req, res, next) {
|
||||||
|
if (req.uid >= 0) {
|
||||||
|
csrfMiddleware(req, res, next);
|
||||||
|
} else {
|
||||||
|
setImmediate(next);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
middleware.ensureLoggedIn = ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login');
|
middleware.ensureLoggedIn = ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login');
|
||||||
|
|
||||||
|
|||||||
@@ -174,8 +174,8 @@ function setupExpressApp(app, callback) {
|
|||||||
secret: nconf.get('secret'),
|
secret: nconf.get('secret'),
|
||||||
key: nconf.get('sessionKey'),
|
key: nconf.get('sessionKey'),
|
||||||
cookie: setupCookie(),
|
cookie: setupCookie(),
|
||||||
resave: true,
|
resave: nconf.get('sessionResave') || false,
|
||||||
saveUninitialized: true,
|
saveUninitialized: nconf.get('sessionSaveUninitialized') || false,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var hsts_option = {
|
var hsts_option = {
|
||||||
|
|||||||
Reference in New Issue
Block a user