mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 05:16:14 +02:00
restoring passwordExpiry for use in continueLogin, fixed tests, hopefully
This commit is contained in:
@@ -397,6 +397,7 @@ authenticationController.localLogin = function (req, username, password, next) {
|
||||
uid = _uid;
|
||||
|
||||
async.parallel({
|
||||
userData: async.apply(db.getObjectFields, 'user:' + uid, ['passwordExpiry']),
|
||||
isAdminOrGlobalMod: function (next) {
|
||||
user.isAdminOrGlobalMod(uid, next);
|
||||
},
|
||||
@@ -406,10 +407,10 @@ authenticationController.localLogin = function (req, username, password, next) {
|
||||
}, next);
|
||||
},
|
||||
function (result, next) {
|
||||
userData = {
|
||||
userData = Object.assign(result.userData, {
|
||||
uid: uid,
|
||||
isAdminOrGlobalMod: result.isAdminOrGlobalMod,
|
||||
};
|
||||
});
|
||||
|
||||
if (!result.isAdminOrGlobalMod && parseInt(meta.config.allowLocalLogin, 10) === 0) {
|
||||
return next(new Error('[[error:local-login-disabled]]'));
|
||||
|
||||
@@ -24,8 +24,11 @@ module.exports = function (User) {
|
||||
},
|
||||
function (_hashedPassword, next) {
|
||||
hashedPassword = _hashedPassword;
|
||||
if (!hashedPassword) {
|
||||
if (uid && !hashedPassword) {
|
||||
return callback(null, true);
|
||||
} else if (!hashedPassword) {
|
||||
// Non-existant user, submit fake hash for comparison
|
||||
hashedPassword = '';
|
||||
}
|
||||
|
||||
User.isPasswordValid(password, 0, next);
|
||||
|
||||
Reference in New Issue
Block a user