mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-12 15:33:20 -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.
|
||||
|
||||
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;
|
||||
}
|
||||
case 'logincookie':
|
||||
@ -5555,6 +5543,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
'adduser': serverCommandAddUser,
|
||||
'adduserbatch': serverCommandAddUserBatch,
|
||||
'addusertousergroup': serverCommandAddUserToUserGroup,
|
||||
'authcookie': serverCommandAuthCookie,
|
||||
'files': serverCommandFiles,
|
||||
'getnetworkinfo': serverCommandGetNetworkInfo,
|
||||
'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) { } }
|
||||
}
|
||||
|
||||
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) {
|
||||
// Send the full list of server files to the browser app
|
||||
updateUserFiles(user, ws, domain);
|
||||
|
Loading…
Reference in New Issue
Block a user