diff --git a/meshagent.js b/meshagent.js
index 686f9005..862873e5 100644
--- a/meshagent.js
+++ b/meshagent.js
@@ -342,8 +342,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// If the mesh agent web socket is closed, clean up.
ws.on('close', function (req) {
if (obj.nodeid != null) {
- //console.log('Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ') id=' + obj.agentInfo.agentId);
- obj.parent.parent.debug(1, 'Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ') id=' + obj.agentInfo.agentId);
+ var agentId = 'Unknown';
+ if (obj.agentInfo && obj.agentInfo.agentId) { agentId = obj.agentInfo.agentId; }
+ //console.log('Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ') id=' + agentId);
+ obj.parent.parent.debug(1, 'Agent disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ') id=' + agentId);
// Log the agent disconnection
if (obj.parent.wsagentsDisconnections[obj.nodeid] == null) {
diff --git a/meshmail.js b/meshmail.js
index 096f2911..cf293c2c 100644
--- a/meshmail.js
+++ b/meshmail.js
@@ -130,7 +130,7 @@ module.exports.CreateMeshMail = function (parent) {
// Set all the options.
var options = { username: username, email: email, servername: domain.title };
- options.cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 1 }, obj.mailCookieEncryptionKey);
+ options.cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username.toLowerCase(), e: email, a: 1 }, obj.mailCookieEncryptionKey);
// Send the email
obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(template.htmlSubject, domain, options), text: mailReplacements(template.txt, domain, options), html: mailReplacements(template.html, domain, options) });
diff --git a/package.json b/package.json
index b2be5b77..19903921 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "meshcentral",
- "version": "0.2.7-y",
+ "version": "0.2.8-b",
"keywords": [
"Remote Management",
"Intel AMT",
diff --git a/sample-config.json b/sample-config.json
index 4825feac..2b6dfaa9 100644
--- a/sample-config.json
+++ b/sample-config.json
@@ -62,6 +62,7 @@
}
},
"_letsencrypt": {
+ "__comment__": "If your are having problems with Let's Encrypt, use https://letsdebug.net/ first to debug it.",
"email": "myemail@myserver.com ",
"names": "myserver.com,customer1.myserver.com",
"rsaKeySize": 3072,
diff --git a/webserver.js b/webserver.js
index fc138a89..de136f4b 100644
--- a/webserver.js
+++ b/webserver.js
@@ -639,9 +639,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((idsplit.length != 2) || (idsplit[0] != domain.id)) {
res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid domain. Go to login page.' });
} else {
- obj.db.Get('user/' + cookie.u, function (err, docs) {
+ obj.db.Get('user/' + cookie.u.toLowerCase(), function (err, docs) {
if (docs.length == 0) {
- res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid username \"' + EscapeHtml(cookie.u) + '\". Go to login page.' });
+ res.render(obj.path.join(obj.parent.webViewsPath, 'message'), { title: domain.title, title2: domain.title2, title3: 'Account Verification', message: 'ERROR: Invalid username \"' + EscapeHtml(idsplit[1]) + '\". Go to login page.' });
} else {
var user = docs[0];
if (user.email != cookie.e) {