mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-27 06:33:15 -05:00
Factorize authcookie
This commit is contained in:
parent
a5b9d02d49
commit
c9462811fc
23
meshuser.js
23
meshuser.js
@ -676,18 +676,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
|
|
||||||
// TODO: Send the message of user sessions connected to other servers.
|
// TODO: Send the message of user sessions connected to other servers.
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'authcookie':
|
|
||||||
{
|
|
||||||
// Renew the authentication cookie
|
|
||||||
try {
|
|
||||||
ws.send(JSON.stringify({
|
|
||||||
action: 'authcookie',
|
|
||||||
cookie: parent.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: req.clientIp }, parent.parent.loginCookieEncryptionKey),
|
|
||||||
rcookie: parent.parent.encodeCookie({ ruserid: user._id }, parent.parent.loginCookieEncryptionKey)
|
|
||||||
}));
|
|
||||||
} catch (ex) { }
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'logincookie':
|
case 'logincookie':
|
||||||
@ -5555,6 +5543,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
'adduser': serverCommandAddUser,
|
'adduser': serverCommandAddUser,
|
||||||
'adduserbatch': serverCommandAddUserBatch,
|
'adduserbatch': serverCommandAddUserBatch,
|
||||||
'addusertousergroup': serverCommandAddUserToUserGroup,
|
'addusertousergroup': serverCommandAddUserToUserGroup,
|
||||||
|
'authcookie': serverCommandAuthCookie,
|
||||||
'files': serverCommandFiles,
|
'files': serverCommandFiles,
|
||||||
'getnetworkinfo': serverCommandGetNetworkInfo,
|
'getnetworkinfo': serverCommandGetNetworkInfo,
|
||||||
'getsysinfo': serverCommandGetSysInfo,
|
'getsysinfo': serverCommandGetSysInfo,
|
||||||
@ -5916,6 +5905,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: 'ok', added: addedCount, failed: failCount })); } catch (ex) { } }
|
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: 'ok', added: addedCount, failed: failCount })); } catch (ex) { } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serverCommandAuthCookie(command) {
|
||||||
|
try {
|
||||||
|
ws.send(JSON.stringify({
|
||||||
|
action: 'authcookie',
|
||||||
|
cookie: parent.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: req.clientIp }, parent.parent.loginCookieEncryptionKey),
|
||||||
|
rcookie: parent.parent.encodeCookie({ ruserid: user._id }, parent.parent.loginCookieEncryptionKey)
|
||||||
|
}));
|
||||||
|
} catch (ex) { }
|
||||||
|
}
|
||||||
|
|
||||||
function serverCommandFiles(command) {
|
function serverCommandFiles(command) {
|
||||||
// Send the full list of server files to the browser app
|
// Send the full list of server files to the browser app
|
||||||
updateUserFiles(user, ws, domain);
|
updateUserFiles(user, ws, domain);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user