mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-14 12:58:37 +03:00
Attempt at a fix for #3344
This commit is contained in:
parent
22014f82b3
commit
40f052e027
@ -4641,16 +4641,19 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
break;
|
||||
}
|
||||
case 'twoFactorCookie': {
|
||||
try {
|
||||
// Do not allow this command when logged in using a login token
|
||||
if (req.session.loginToken != null) break;
|
||||
|
||||
// Do not allows this command is 2FA cookie duration is set to zero
|
||||
if (domain.twofactorcookiedurationdays === 0) break;
|
||||
|
||||
// Generate a two-factor cookie
|
||||
if (((domain.twofactorcookiedurationdays == null) || (domain.twofactorcookiedurationdays > 0))) {
|
||||
var maxCookieAge = domain.twofactorcookiedurationdays;
|
||||
if (typeof maxCookieAge != 'number') { maxCookieAge = 30; }
|
||||
if ((typeof maxCookieAge != 'number') || (maxCookieAge < 1)) { maxCookieAge = 30; }
|
||||
const twoFactorCookie = parent.parent.encodeCookie({ userid: user._id, expire: maxCookieAge * 24 * 60 /*, ip: req.clientIp*/ }, parent.parent.loginCookieEncryptionKey);
|
||||
try { ws.send(JSON.stringify({ action: 'twoFactorCookie', cookie: twoFactorCookie })); } catch (ex) { }
|
||||
}
|
||||
} catch (ex) { console.log(ex); }
|
||||
break;
|
||||
}
|
||||
case 'amtsetupbin': {
|
||||
|
Loading…
Reference in New Issue
Block a user