restoring passwordExpiry for use in continueLogin, fixed tests, hopefully

v1.18.x
Julian Lam 7 years ago
parent 786af5fbb3
commit 3c6c0ed7a1

@ -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);

Loading…
Cancel
Save