Improved email system, mail templates in /meshcentral-data/mail-templates

Ylian Saint-Hilaire committed Sep 6, 2018 at 15:58 UTC e39157b0ad434b3457b597267522ebca54741945
4 files changed +107 -66
meshmail.js
+103 -62
@@ -22,23 +22,9 @@ module.exports.CreateMeshMail = function (parent) {
22 obj.retry = 0;
23 obj.sendingMail = false;
24 obj.mailCookieEncryptionKey = null;
25 + obj.mailTemplates = {};
26 const nodemailer = require('nodemailer');
27
27 - // Default account email validation mail
28 - const accountCheckSubject = '[[[SERVERNAME]]] - Email Verification';
29 - const accountCheckMailHtml = '<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Verification</b></td></tr></table><p>Hi [[[USERNAME]]], <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting email verification, click on the following link to complete the process.</p><p style="margin-left:30px"><a href="[[[CALLBACKURL]]]">Click here to verify your e-mail address.</a></p>If you did not initiate this request, please ignore this mail.</div>';
30 - const accountCheckMailText = '[[[SERVERNAME]]] - Verification\r\n\r\nHi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]]) is performing an e-mail verification. Nagivate to the following link to complete the process: [[[CALLBACKURL]]]\r\nIf you did not initiate this request, please ignore this mail.\r\n';
31 -
32 - // Default account reset mail
33 - const accountResetSubject = '[[[SERVERNAME]]] - Account Reset';
34 - const accountResetMailHtml = '<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Verification</b></td></tr></table><p>Hi [[[USERNAME]]], <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting an account password reset, click on the following link to complete the process.</p><p style="margin-left:30px"><a href="[[[CALLBACKURL]]]">Click here to reset your account password.</a></p>If you did not initiate this request, please ignore this mail.</div>';
35 - const accountResetMailText = '[[[SERVERNAME]]] - Account Reset\r\n\r\nHi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]]) is requesting an account password reset. Nagivate to the following link to complete the process: [[[CALLBACKURL]]]\r\nIf you did not initiate this request, please ignore this mail.\r\n';
36 -
37 - // Default account invite mail
38 - const accountInviteSubject = '[[[SERVERNAME]]] - Invitation';
39 - const accountInviteMailHtml = '<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Agent Installation</b></td></tr></table><p>[[[INTROHTML]]]User [[[USERNAME]]] on server <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting you to download the following software to start the remote control session.</p>[[[MSGHTML]]][[[AGENTHTML]]]<p>If you did not initiate this request, please ignore this mail.</p>Best regards,<br>[[[USERNAME]]]<br></div>';
40 - const accountInviteMailText = '[[[SERVERNAME]]] - Agent Installation Invitation\r\n\r\n[[[INTROTEXT]]]User [[[USERNAME]]] on server [[[SERVERNAME]]] ([[[SERVERURL]]]) is requesting you to download the following software to start the remote control session. [[[MSGTEXT]]][[[AGENTTEXT]]]If you did not initiate this request, please ignore this mail.\r\n\r\nBest regards,\r\n[[[USERNAME]]]\r\n';
41 -
28 function EscapeHtml(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
29 //function EscapeHtmlBreaks(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, '&nbsp;&nbsp;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
30
@@ -48,36 +34,87 @@ module.exports.CreateMeshMail = function (parent) {
34 if ((parent.config.smtp.user != null) && (parent.config.smtp.pass != null)) { options.auth = { user: parent.config.smtp.user, pass: parent.config.smtp.pass }; }
35 obj.smtpServer = nodemailer.createTransport(options);
36
37 + // Set default mail templates
38 + // You can override these by placing a file with the same name in "meshcentral-data/mail"
39 + // If the server hash many domains, just add the domainid to the file like this: 'account-check-customer1.html', 'mesh-invite-customer1.txt'.
40 + obj.mailTemplates['account-check.html'] = '<title>[[[SERVERNAME]]] - Email Verification</title>\r\n<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Verification</b></td></tr></table><p>Hi [[[USERNAME]]], <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting email verification, click on the following link to complete the process.</p><p style="margin-left:30px"><a href="[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]]">Click here to verify your e-mail address.</a></p>If you did not initiate this request, please ignore this mail.</div>';
41 + obj.mailTemplates['account-reset.html'] = '<title>[[[SERVERNAME]]] - Account Reset</title>\r\n<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Verification</b></td></tr></table><p>Hi [[[USERNAME]]], <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting an account password reset, click on the following link to complete the process.</p><p style="margin-left:30px"><a href="[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]]">Click here to reset your account password.</a></p>If you did not initiate this request, please ignore this mail.</div>';
42 + obj.mailTemplates['mesh-invite.html'] = '<title>[[[SERVERNAME]]] - Invitation</title>\r\n<div style="font-family:Arial,Helvetica,sans-serif"><table style="background-color:#003366;color:lightgray;width:100%" cellpadding=8><tr><td><b style="font-size:20px;font-family:Arial,Helvetica,sans-serif">[[[SERVERNAME]]] - Agent Installation</b></td></tr></table>[[[AREA-NAME]]]<p>Hello [[[NAME]]],</p>[[[/AREA-NAME]]]<p>User [[[USERNAME]]] on server <a href="[[[SERVERURL]]]">[[[SERVERNAME]]]</a> is requesting you to download the following software to start the remote control session.</p>[[[AREA-MSG]]]<p>Message: <b>[[[MSG]]]</b></p>[[[/AREA-MSG]]][[[AREA-WINDOWS]]]<p style="margin-left:30px"><a href="[[[SERVERURL]]]/meshagents?id=3&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]">Click here to download the MeshAgent for Windows.</a></p>[[[/AREA-WINDOWS]]][[[AREA-LINUX]]]<p>For Linux, cut & paste the following in a terminal to install the agent:<br /><pre style="margin-left:30px">wget -q [[[SERVERURL]]]/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] [[[MESHIDHEX]]]</pre></p>[[[/AREA-LINUX]]]<p>If you did not initiate this request, please ignore this mail.</p>Best regards,<br>[[[USERNAME]]]<br></div>';
43 + obj.mailTemplates['account-check.txt'] = '[[[SERVERNAME]]] - Email Verification\r\nHi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]]) is performing an e-mail verification. Nagivate to the following link to complete the process:\r\n\r\n[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]]\r\n\r\nIf you did not initiate this request, please ignore this mail.\r\n';
44 + obj.mailTemplates['account-reset.txt'] = '[[[SERVERNAME]]] - Account Reset\r\nHi [[[USERNAME]]], [[[SERVERNAME]]] ([[[SERVERURL]]]) is requesting an account password reset. Nagivate to the following link to complete the process:\r\n\r\n[[[SERVERURL]]]/checkmail?c=[[[COOKIE]]]\r\n\r\nIf you did not initiate this request, please ignore this mail.';
45 + obj.mailTemplates['mesh-invite.txt'] = '[[[SERVERNAME]]] - Invitation\r\n[[[AREA-NAME]]]Hello [[[NAME]]],\r\n\r\n[[[/AREA-NAME]]]User [[[USERNAME]]] on server [[[SERVERNAME]]] ([[[SERVERURL]]]/) is requesting you to download the following software to start the remote control session.[[[AREA-MSG]]]\r\n\r\nMessage: [[[MSG]]]\r\n\r\n[[[/AREA-MSG]]][[[AREA-WINDOWS]]]For Windows, nagivate to the following link to complete the process:\r\n\r\n[[[SERVERURL]]]/meshagents?id=3&meshid=[[[MESHIDHEX]]]&tag=mailto:[[[EMAIL]]]\r\n\r\n[[[/AREA-WINDOWS]]][[[AREA-LINUX]]]For Linux, cut & paste the following in a terminal to install the agent:\r\n\r\nwget -q [[[SERVERURL]]]/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] [[[MESHIDHEX]]]\r\n\r\n[[[/AREA-LINUX]]]If you did not initiate this request, please ignore this mail.\r\n\r\nBest regards,\r\n[[[USERNAME]]]';
46 +
47 + // Load all of the mail templates if present
48 + if (obj.parent.fs.existsSync(obj.parent.path.join(obj.parent.datapath, 'mail-templates'))) {
49 + var mailDir = null;
50 + try { mailDir = obj.parent.fs.readdirSync(obj.parent.path.join(obj.parent.datapath, 'mail-templates')); } catch (e) { }
51 + if (mailDir != null) {
52 + // Load all mail templates
53 + for (var i in mailDir) {
54 + var templateName = mailDir[i].toLowerCase();
55 + if (templateName.endsWith('.html') || templateName.endsWith('.txt')) { obj.mailTemplates[templateName] = obj.parent.fs.readFileSync(obj.parent.path.join(obj.parent.datapath, 'mail-templates', mailDir[i])).toString(); }
56 + }
57 + }
58 + } else {
59 + // Save the default templates
60 + try {
61 + obj.parent.fs.mkdirSync(obj.parent.path.join(obj.parent.datapath, 'mail-templates'));
62 + for (var i in obj.mailTemplates) { obj.parent.fs.writeFileSync(obj.parent.path.join(obj.parent.datapath, 'mail-templates', i), obj.mailTemplates[i], 'utf8'); }
63 + } catch (e) { console.error(e); }
64 + }
65 +
66 + // Get the correct mail template
67 + function getTemplate(name, domain, html) {
68 + if (domain != null) { var r = obj.mailTemplates[name + '-' + domain.id + (html ? '.html' : '.txt')]; if (r) return r; }
69 + return obj.mailTemplates[name + (html ? '.html' : '.txt')];
70 + }
71 +
72 + // Get the correct mail template object
73 + function getTemplateEx(name, domain) {
74 + var r = {}, txt = getTemplate(name, domain, 0), html = getTemplate(name, domain, 1);
75 + r.txtSubject = txt.split('\r\n')[0];
76 + r.htmlSubject = getStrBetween(html, '<title>', '</title>\r\n');
77 + r.txt = txt.substring(txt.indexOf('\r\n') + 2);
78 + r.html = html.substring(html.indexOf('\r\n') + 2);
79 + return r;
80 + }
81 +
82 + // Get the string between two markers
83 + function getStrBetween(str, start, end) {
84 + var si = str.indexOf(start), ei = str.indexOf(end);
85 + if ((si == -1) || (ei == -1) || (si > ei)) return null;
86 + return str.substring(si + start.length, ei);
87 + }
88 +
89 + // Remove the string between two markers
90 + function removeStrBetween(str, start, end) {
91 + var si = str.indexOf(start), ei = str.indexOf(end);
92 + if ((si == -1) || (ei == -1) || (si > ei)) return str;
93 + return str.substring(0, si) + str.substring(ei + end.length);
94 + }
95 +
96 + // Remove the string between two markers
97 + function strZone(str, marker, keep) {
98 + marker = marker.toUpperCase();
99 + if (keep) { return str.split('[[[AREA-' + marker + ']]]').join('').split('[[[/AREA-' + marker + ']]]').join(''); }
100 + return removeStrBetween(str, '[[[AREA-' + marker + ']]]', '[[[/AREA-' + marker + ']]]');
101 + }
102 +
103 // Perform all e-mail substitution
52 - function mailReplacements(text, domain, username, email, options) {
53 - var url;
104 + function mailReplacements(text, domain, options) {
105 if (domain.dns == null) {
106 // Default domain or subdomain of the default.
56 - url = 'http' + ((obj.parent.args.notls == null) ? 's' : '') + '://' + parent.certificates.CommonName + ':' + obj.parent.args.port + domain.url;
107 + options.serverurl = 'http' + ((obj.parent.args.notls == null) ? 's' : '') + '://' + obj.parent.certificates.CommonName + ':' + obj.parent.args.port + domain.url;
108 } else {
109 // Domain with a DNS name.
59 - url = 'http' + ((obj.parent.args.notls == null) ? 's' : '') + '://' + domain.dns + ':' + obj.parent.args.port + domain.url;
110 + options.serverurl = 'http' + ((obj.parent.args.notls == null) ? 's' : '') + '://' + domain.dns + ':' + obj.parent.args.port + domain.url;
111 }
61 - if (options) {
62 - if (options.cookie == null) { options.cookie = ''; }
63 - if (options.agentlinkhtml == null) { options.agentlinkhtml = ''; }
64 - if (options.agentlinktext == null) { options.agentlinktext = ''; }
65 - if (options.meshid == null) { options.meshid = ''; }
66 - if (options.introtext == null) { options.introtext = ''; }
67 - if (options.introhtml == null) { options.introhtml = ''; }
68 - if (options.msgtext == null) { options.msgtext = ''; }
69 - if (options.msghtml == null) { options.msghtml = ''; }
70 -
71 - text = text.split('[[[CALLBACKURL]]]').join(url + 'checkmail?c=' + options.cookie);
72 - text = text.split('[[[AGENTHTML]]]').join(options.agentlinkhtml);
73 - text = text.split('[[[AGENTTEXT]]]').join(options.agentlinktext);
74 - text = text.split('[[[MESHID]]]').join(options.meshid);
75 - text = text.split('[[[INTROTEXT]]]').join(options.introtext);
76 - text = text.split('[[[INTROHTML]]]').join(options.introhtml);
77 - text = text.split('[[[MSGTEXT]]]').join(options.msgtext);
78 - text = text.split('[[[MSGHTML]]]').join(options.msghtml);
112 + if (options.serverurl.endsWith('/')) { options.serverurl = options.serverurl.substring(0, options.serverurl.length - 1); } // Remove the ending / if present
113 + for (var i in options) {
114 + text = strZone(text, i.toUpperCase(), options[i]); // Adjust this text area
115 + text = text.split('[[[' + i.toUpperCase() + ']]]').join(options[i]); // Replace this value
116 }
80 - return text.split('[[[USERNAME]]]').join(username).split('[[[SERVERURL]]]').join(url).split('[[[SERVERNAME]]]').join(domain.title).split('[[[EMAIL]]]').join(EscapeHtml(email)).split('[[[URL]]]').join(url);
117 + return text;
118 }
119
120 // Send a mail
@@ -88,40 +125,44 @@ module.exports.CreateMeshMail = function (parent) {
125
126 // Send account check mail
127 obj.sendAccountCheckMail = function (domain, username, email) {
91 - if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, no reset possible.
92 - var cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 1 }, obj.mailCookieEncryptionKey);
93 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(accountCheckSubject, domain, username, email), text: mailReplacements(accountCheckMailText, domain, username, email, { cookie: cookie }), html: mailReplacements(accountCheckMailHtml, domain, username, email, { cookie: cookie }) });
128 + var template = getTemplateEx('account-check', domain);
129 + if ((template == null) || (template.htmlSubject == null) || (template.txtSubject == null) || (parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, no reset possible.
130 +
131 + // Set all the options.
132 + var options = { username: username, email: email, servername: domain.title };
133 + options.cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 1 }, obj.mailCookieEncryptionKey);
134 +
135 + // Send the email
136 + 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) });
137 sendNextMail();
138 };
139
140 // Send account reset mail
141 obj.sendAccountResetMail = function (domain, username, email) {
99 - if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, don't validate the email address.
100 - var cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 2 }, obj.mailCookieEncryptionKey);
101 - obj.pendingMails.push({ to: email, from: parent.config.smtp.from, subject: mailReplacements(accountResetSubject, domain, username, email), text: mailReplacements(accountResetMailText, domain, username, email, { cookie: cookie }), html: mailReplacements(accountResetMailHtml, domain, username, email, { cookie: cookie }) });
142 + var template = getTemplateEx('account-reset', domain);
143 + if ((template == null) || (template.htmlSubject == null) || (template.txtSubject == null) || (parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, don't validate the email address.
144 +
145 + // Set all the options.
146 + var options = { username: username, email: email, servername: domain.title };
147 + options.cookie = obj.parent.encodeCookie({ u: domain.id + '/' + username, e: email, a: 2 }, obj.mailCookieEncryptionKey);
148 +
149 + // Send the email
150 + 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) });
151 sendNextMail();
152 };
153
154 // Send agent invite mail
155 obj.sendAgentInviteMail = function (domain, username, email, meshid, name, os, msg) {
107 - if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, can't do this.
108 - var options = { meshid: meshid.split('/')[2] };
109 - var agentLinkHtml = '';
110 - var agentLinkText = '';
111 - if (os == 0 || os == 1) { // All OS or Windows
112 - agentLinkHtml += '<p style="margin-left:30px"><a href="[[[SERVERURL]]]/meshagents?id=3&meshid=[[[MESHID]]]&tag=mailto:[[[EMAIL]]]">Click here to download the MeshAgent for Windows.</a></p>';
113 - agentLinkText += 'For Windows, nagivate to the following link to complete the process:\r\n\r\n[[[SERVERURL]]]/meshagents?id=3&meshid=[[[MESHID]]]&tag=mailto:[[[EMAIL]]]\r\n\r\n';
114 - }
115 - if (os == 0 || os == 2) { // All OS or Linux
116 - agentLinkHtml += '<p>For Linux, cut & paste the following in a terminal to install the agent:<br/><pre style="margin-left:30px">wget -q [[[SERVERURL]]]/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHID]]]\'</pre></p>';
117 - agentLinkText += 'For Linux, cut & paste the following in a terminal to install the agent:\r\n\r\nwget -q [[[SERVERURL]]]/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh [[[SERVERURL]]] \'[[[MESHID]]]\'\r\n\r\n';
118 - }
119 - options.agentlinkhtml = agentLinkHtml;
120 - options.agentlinktext = agentLinkText;
121 - if ((name != null) && (name != '')) { options.introtext = 'Hello ' + name + ',\r\n\r\n'; options.introhtml = '<p>Hello ' + name + ',</p>'; }
122 - if ((msg != null) && (msg != '')) { options.msgtext = '\r\n\r\nMessage: ' + msg + '\r\n\r\n'; options.msghtml = '<p>Message: <b>' + msg + '</b></p>'; }
123 - var mail = { to: email, from: parent.config.smtp.from, subject: mailReplacements(accountInviteSubject, domain, username, email), text: mailReplacements(accountInviteMailText, domain, username, email, options), html: mailReplacements(accountInviteMailHtml, domain, username, email, options) };
124 - obj.pendingMails.push(mail);
156 + var template = getTemplateEx('mesh-invite', domain);
157 + if ((template == null) || (template.htmlSubject == null) || (template.txtSubject == null) || (parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName == 'un-configured')) return; // If the server name is not set, don't validate the email address.
158 +
159 + // Set all the template replacement options and generate the final email text (both in txt and html formats).
160 + var options = { username: username, name: name, email: email, msg: msg, meshid: meshid, meshidhex: meshid.split('/')[2], servername: domain.title };
161 + options.linux = ((os == 0) || (os == 2)) ? 1 : 0;
162 + options.windows = ((os == 0) || (os == 1)) ? 1 : 0;
163 +
164 + // Send the email
165 + 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) });
166 sendNextMail();
167 };
168
views/default.handlebars
+2 -2
@@ -2016,11 +2016,11 @@
2016
2017 if (serverinfo.https == true) {
2018 var portStr = (serverinfo.port == 443)?'':(":" + serverinfo.port);
2019 - Q('agins_linux_area').value = "wget -q https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
2019 + Q('agins_linux_area').value = "wget -q https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://" + servername + portStr + " " + meshid.split('/')[2] + "\r\n";
2020 Q('agins_linux_area_un').value = "wget -q https://" + servername + portStr + "/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
2021 } else {
2022 var portStr = (serverinfo.port == 80)?'':(":" + serverinfo.port);
2023 - Q('agins_linux_area').value = "wget -q http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " '" + meshid.split('/')[2] + "'\r\n";
2023 + Q('agins_linux_area').value = "wget -q http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://" + servername + portStr + " " + meshid.split('/')[2] + "\r\n";
2024 Q('agins_linux_area_un').value = "wget -q http://" + servername + portStr + "/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n";
2025 }
2026 Q('aginsSelect').focus();
views/login-mobile.handlebars
+1 -1
@@ -177,7 +177,7 @@
177 'use strict';
178 var passhint = "{{{passhint}}}";
179 var newAccountPass = parseInt('{{{newAccountPass}}}');
180 - var emailCheck = parseInt('{{{emailcheck}}}');
180 + var emailCheck = ('{{{emailcheck}}}' == 'true');
181 var features = parseInt('{{{features}}}');
182
183 function startup() {
views/login.handlebars
+1 -1
@@ -171,7 +171,7 @@
171 'use strict';
172 var passhint = "{{{passhint}}}";
173 var newAccountPass = parseInt('{{{newAccountPass}}}');
174 - var emailCheck = parseInt('{{{emailcheck}}}');
174 + var emailCheck = ('{{{emailcheck}}}' == 'true');
175 var features = parseInt('{{{features}}}');
176
177 function startup() {