Fix for server exception when connecting tools.

This commit is contained in:
Ylian Saint-Hilaire 2021-06-14 17:48:55 -07:00
parent a0680094a8
commit 5e7669e6d8
2 changed files with 1 additions and 1 deletions

Binary file not shown.

View File

@ -6262,7 +6262,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
obj.authenticate(req.query.user, req.query.pass, domain, function (err, userid, passhint, loginOptions) {
// Check if user as the "notools" site right. If so, deny this connection as tools are not allowed to connect.
if ((user.siteadmin != 0xFFFFFFFF) && (user.siteadmin & SITERIGHT_NOMESHCMD)) {
if ((user != null) && (user.siteadmin != 0xFFFFFFFF) && (user.siteadmin & SITERIGHT_NOMESHCMD)) {
// No tools allowed, close the websocket connection
parent.debug('web', 'ERR: Websocket no tools allowed');
try { ws.send(JSON.stringify({ action: 'close', cause: 'notools', msg: 'notools' })); ws.close(); } catch (e) { }