mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 21:48:11 +02:00
closes #2304
This commit is contained in:
@@ -93,7 +93,7 @@ module.exports = function (middleware) {
|
||||
reputation: 0,
|
||||
'email:confirmed': 0,
|
||||
};
|
||||
if (req.uid) {
|
||||
if (req.loggedIn) {
|
||||
user.getUserFields(req.uid, Object.keys(userData), next);
|
||||
} else {
|
||||
next(null, userData);
|
||||
|
||||
@@ -59,12 +59,12 @@ middleware.pageView = function (req, res, next) {
|
||||
|
||||
plugins.fireHook('action:middleware.pageView', { req: req });
|
||||
|
||||
if (req.user) {
|
||||
user.updateLastOnlineTime(req.user.uid);
|
||||
if (req.loggedIn) {
|
||||
user.updateLastOnlineTime(req.uid);
|
||||
if (req.path.startsWith('/api/users') || req.path.startsWith('/users')) {
|
||||
user.updateOnlineUsers(req.user.uid, next);
|
||||
user.updateOnlineUsers(req.uid, next);
|
||||
} else {
|
||||
user.updateOnlineUsers(req.user.uid);
|
||||
user.updateOnlineUsers(req.uid);
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
@@ -112,7 +112,7 @@ middleware.routeTouchIcon = function (req, res) {
|
||||
};
|
||||
|
||||
middleware.privateTagListing = function (req, res, next) {
|
||||
if (!req.user && parseInt(meta.config.privateTagListing, 10) === 1) {
|
||||
if (!req.loggedIn && parseInt(meta.config.privateTagListing, 10) === 1) {
|
||||
controllers.helpers.notAllowed(req, res);
|
||||
} else {
|
||||
next();
|
||||
@@ -143,7 +143,7 @@ function expose(exposedField, method, field, req, res, next) {
|
||||
}
|
||||
|
||||
middleware.privateUploads = function (req, res, next) {
|
||||
if (req.user || parseInt(meta.config.privateUploads, 10) !== 1) {
|
||||
if (req.loggedIn || parseInt(meta.config.privateUploads, 10) !== 1) {
|
||||
return next();
|
||||
}
|
||||
if (req.path.startsWith(nconf.get('relative_path') + '/assets/uploads/files')) {
|
||||
|
||||
@@ -14,7 +14,7 @@ var controllers = {
|
||||
|
||||
module.exports = function (middleware) {
|
||||
middleware.authenticate = function (req, res, next) {
|
||||
if (req.uid) {
|
||||
if (req.loggedIn) {
|
||||
return next();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ module.exports = function (middleware) {
|
||||
*/
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
if (!req.uid) {
|
||||
if (!req.loggedIn) {
|
||||
return setImmediate(next, null, false);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ module.exports = function (middleware) {
|
||||
}
|
||||
|
||||
middleware.checkGlobalPrivacySettings = function (req, res, next) {
|
||||
if (!req.uid && !!parseInt(meta.config.privateUserInfo, 10)) {
|
||||
if (!req.loggedIn && !!parseInt(meta.config.privateUserInfo, 10)) {
|
||||
return middleware.authenticate(req, res, next);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ module.exports = function (middleware) {
|
||||
};
|
||||
|
||||
middleware.requireUser = function (req, res, next) {
|
||||
if (req.uid) {
|
||||
if (req.loggedIn) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user