mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-24 03:49:10 -05:00
Attempt at a fix for #3344
This commit is contained in:
parent
22014f82b3
commit
40f052e027
15
meshuser.js
15
meshuser.js
@ -4641,16 +4641,19 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'twoFactorCookie': {
|
case 'twoFactorCookie': {
|
||||||
// Do not allow this command when logged in using a login token
|
try {
|
||||||
if (req.session.loginToken != null) break;
|
// Do not allow this command when logged in using a login token
|
||||||
|
if (req.session.loginToken != null) break;
|
||||||
|
|
||||||
// Generate a two-factor cookie
|
// Do not allows this command is 2FA cookie duration is set to zero
|
||||||
if (((domain.twofactorcookiedurationdays == null) || (domain.twofactorcookiedurationdays > 0))) {
|
if (domain.twofactorcookiedurationdays === 0) break;
|
||||||
|
|
||||||
|
// Generate a two-factor cookie
|
||||||
var maxCookieAge = domain.twofactorcookiedurationdays;
|
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);
|
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) { }
|
try { ws.send(JSON.stringify({ action: 'twoFactorCookie', cookie: twoFactorCookie })); } catch (ex) { }
|
||||||
}
|
} catch (ex) { console.log(ex); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'amtsetupbin': {
|
case 'amtsetupbin': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user