mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 14:00:29 +01:00
Compare commits
1 Commits
v3.0.0
...
revert-pas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7be3d84397 |
@@ -104,7 +104,7 @@
|
|||||||
"nodebb-widget-essentials": "6.0.0",
|
"nodebb-widget-essentials": "6.0.0",
|
||||||
"nodemailer": "6.7.7",
|
"nodemailer": "6.7.7",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"passport": "0.6.0",
|
"passport": "0.5.2",
|
||||||
"passport-http-bearer": "1.0.1",
|
"passport-http-bearer": "1.0.1",
|
||||||
"passport-local": "1.0.0",
|
"passport-local": "1.0.0",
|
||||||
"pg": "8.7.3",
|
"pg": "8.7.3",
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ authenticationController.doLogin = async function (req, uid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await loginAsync({ uid: uid }, { keepSessionInfo: true });
|
await loginAsync({ uid: uid });
|
||||||
await authenticationController.onSuccessfulLogin(req, uid);
|
await authenticationController.onSuccessfulLogin(req, uid);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -459,7 +459,6 @@ authenticationController.localLogin = async function (req, username, password, n
|
|||||||
};
|
};
|
||||||
|
|
||||||
const destroyAsync = util.promisify((req, callback) => req.session.destroy(callback));
|
const destroyAsync = util.promisify((req, callback) => req.session.destroy(callback));
|
||||||
const logoutAsync = util.promisify((req, callback) => req.logout(callback));
|
|
||||||
|
|
||||||
authenticationController.logout = async function (req, res, next) {
|
authenticationController.logout = async function (req, res, next) {
|
||||||
if (!req.loggedIn || !req.sessionID) {
|
if (!req.loggedIn || !req.sessionID) {
|
||||||
@@ -471,7 +470,7 @@ authenticationController.logout = async function (req, res, next) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await user.auth.revokeSession(sessionID, uid);
|
await user.auth.revokeSession(sessionID, uid);
|
||||||
await logoutAsync(req);
|
req.logout();
|
||||||
|
|
||||||
await destroyAsync(req);
|
await destroyAsync(req);
|
||||||
res.clearCookie(nconf.get('sessionKey'), meta.configs.cookie.get());
|
res.clearCookie(nconf.get('sessionKey'), meta.configs.cookie.get());
|
||||||
|
|||||||
@@ -41,10 +41,8 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if (!canLoginIfBanned && req.loggedIn) {
|
if (!canLoginIfBanned && req.loggedIn) {
|
||||||
req.logout(() => {
|
req.logout();
|
||||||
res.redirect('/');
|
return res.redirect('/');
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.locals.config = config;
|
res.locals.config = config;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = function (middleware) {
|
|||||||
async function authenticate(req, res) {
|
async function authenticate(req, res) {
|
||||||
async function finishLogin(req, user) {
|
async function finishLogin(req, user) {
|
||||||
const loginAsync = util.promisify(req.login).bind(req);
|
const loginAsync = util.promisify(req.login).bind(req);
|
||||||
await loginAsync(user, { keepSessionInfo: true });
|
await loginAsync(user);
|
||||||
await controllers.authentication.onSuccessfulLogin(req, user.uid);
|
await controllers.authentication.onSuccessfulLogin(req, user.uid);
|
||||||
req.uid = user.uid;
|
req.uid = user.uid;
|
||||||
req.loggedIn = req.uid > 0;
|
req.loggedIn = req.uid > 0;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ Auth.reloadRoutes = async function (params) {
|
|||||||
})(req, res, next);
|
})(req, res, next);
|
||||||
}, Auth.middleware.validateAuth, (req, res, next) => {
|
}, Auth.middleware.validateAuth, (req, res, next) => {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
async.apply(req.login.bind(req), res.locals.user, { keepSessionInfo: true }),
|
async.apply(req.login.bind(req), res.locals.user),
|
||||||
async.apply(controllers.authentication.onSuccessfulLogin, req, req.uid),
|
async.apply(controllers.authentication.onSuccessfulLogin, req, req.uid),
|
||||||
], (err) => {
|
], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user