mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 03:21:18 +01:00
fix: dont show /register page after req.session.forceLogin is set
repro 1. try to access acp after timeout 2. you get redirected to login 3. try to load /register and you get the /register page even though you are already logged in
This commit is contained in:
@@ -198,7 +198,7 @@ module.exports = function (middleware) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
middleware.redirectToAccountIfLoggedIn = helpers.try(async (req, res, next) => {
|
middleware.redirectToAccountIfLoggedIn = helpers.try(async (req, res, next) => {
|
||||||
if (req.session.forceLogin || req.uid <= 0) {
|
if ((req.path === '/login' && req.session.forceLogin) || req.uid <= 0) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
const userslug = await user.getUserField(req.uid, 'userslug');
|
const userslug = await user.getUserField(req.uid, 'userslug');
|
||||||
|
|||||||
Reference in New Issue
Block a user