From 3dc616151ac1a9b459387d1dc571bfd236d8c2b3 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 21 Dec 2020 23:32:50 -0800 Subject: [PATCH] Added LoginFooter option. --- meshcentral-config-schema.json | 3 ++- sample-config-advanced.json | 1 + webserver.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 00662b37..e176d58e 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -174,7 +174,8 @@ "welcomeText": { "type": "string", "description": "Text that will be shown on the login screen." }, "welcomePicture": { "type": "string", "description": "Name of the PNG or JPEG file that will be shown on the login screen. Put this file in the meshcentral-data folder and place the file name here." }, "hide": { "type": "integer", "default": 0 }, - "footer": { "type": "string", "default": null }, + "footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." }, + "loginfooter": { "type": "string", "default": null "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." }, "certUrl": { "type": "string", "format": "uri", diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 8d8acea1..432a3942 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -139,6 +139,7 @@ "___hide__": "Sum of: 1 = Hide header, 2 = Hide tab, 4 = Hide footer, 8 = Hide title, 16 = Hide left bar", "_hide": 4, "_footer": "Twitter", + "_loginfooter": "This is a private server.", "_certUrl": "https://192.168.2.106:443/", "myServer": { "Backup": false, diff --git a/webserver.js b/webserver.js index 4f8834a8..36292270 100644 --- a/webserver.js +++ b/webserver.js @@ -2554,7 +2554,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (domain.customui != null) { customui = encodeURIComponent(JSON.stringify(domain.customui)); } // Render the login page - render(req, res, getRenderPage((domain.sitestyle == 2) ? 'login2' : 'login', req, domain), getRenderArgs({ loginmode: loginmode, rootCertLink: getRootCertLink(), newAccount: newAccountsAllowed, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, passlogin: (typeof domain.showpasswordlogin == 'boolean') ? domain.showpasswordlogin : true, emailcheck: emailcheck, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, customui: customui, footer: (domain.footer == null) ? '' : domain.footer, hkey: encodeURIComponent(hardwareKeyChallenge).replace(/'/g, '%27'), messageid: msgid, passhint: passhint, welcometext: domain.welcometext ? encodeURIComponent(domain.welcometext).split('\'').join('\\\'') : null, hwstate: hwstate, otpemail: otpemail, otpsms: otpsms, twoFactorCookieDays: twoFactorCookieDays, authStrategies: authStrategies.join(','), loginpicture: (typeof domain.loginpicture == 'string') }, req, domain, (domain.sitestyle == 2) ? 'login2' : 'login')); + render(req, res, getRenderPage((domain.sitestyle == 2) ? 'login2' : 'login', req, domain), getRenderArgs({ loginmode: loginmode, rootCertLink: getRootCertLink(), newAccount: newAccountsAllowed, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: obj.getWebServerName(domain), serverPublicPort: httpsPort, passlogin: (typeof domain.showpasswordlogin == 'boolean') ? domain.showpasswordlogin : true, emailcheck: emailcheck, features: features, sessiontime: args.sessiontime, passRequirements: passRequirements, customui: customui, footer: (domain.loginfooter == null) ? '' : domain.loginfooter, hkey: encodeURIComponent(hardwareKeyChallenge).replace(/'/g, '%27'), messageid: msgid, passhint: passhint, welcometext: domain.welcometext ? encodeURIComponent(domain.welcometext).split('\'').join('\\\'') : null, hwstate: hwstate, otpemail: otpemail, otpsms: otpsms, twoFactorCookieDays: twoFactorCookieDays, authStrategies: authStrategies.join(','), loginpicture: (typeof domain.loginpicture == 'string') }, req, domain, (domain.sitestyle == 2) ? 'login2' : 'login')); } // Handle a post request on the root