This commit is contained in:
Ylian Saint-Hilaire 2021-05-25 11:17:23 -07:00
parent c20f3549d5
commit b9f34381e9
3 changed files with 12 additions and 4 deletions

View File

@ -76,7 +76,7 @@
case 10: { msg = "ERROR: Invalid account check, verification url is only valid for 30 minutes."; break; }
case 11: { msg = "Sharing link not valid yet."; break; }
case 12: { msg = "Sharing link is expired."; break; }
case 13: { msg = "If you are an administrator, [login here].".replace('[', '<a href=login?admin=1>').replace(']', '</a>'); break; }
case 13: { msg = "If you are an administrator, [login here].".replace('[', '<a href=login?loginscreen=1>').replace(']', '</a>'); break; }
case 14: { msg = '<a href=' + window.location.href + '&confirm=1>' + "Click here to reset your account password." + '</a>'; break; }
}

View File

@ -77,7 +77,7 @@
case 10: { msg = "ERROR: Invalid account check, verification url is only valid for 30 minutes."; break; }
case 11: { msg = "Sharing link not valid yet."; break; }
case 12: { msg = "Sharing link is expired."; break; }
case 13: { msg = "If you are an administrator, [login here].".replace('[', '<a href=?admin=1>').replace(']', '</a>'); break; }
case 13: { msg = "If you are an administrator, [login here].".replace('[', '<a href=?loginscreen=1>').replace(']', '</a>'); break; }
case 14: { msg = '<a href=' + window.location.href + '&confirm=1>' + "Click here to reset your account password." + '</a>'; break; }
}

View File

@ -1841,7 +1841,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
// Check if we are in maintenance mode
if ((parent.config.settings.maintenancemode != null) && (req.query.admin !== '1')) {
if ((parent.config.settings.maintenancemode != null) && (req.query.loginscreen !== '1')) {
render(req, res, getRenderPage((domain.sitestyle == 2) ? 'message2' : 'message', req, domain), getRenderArgs({ titleid: 3, msgid: 13, domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27') }, req, domain));
return;
}
@ -2391,7 +2391,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((req.session != null) && (typeof req.session.expire == 'number') && ((req.session.expire - Date.now()) <= 0)) { for (var i in req.session) { delete req.session[i]; } }
// Check if we are in maintenance mode
if ((parent.config.settings.maintenancemode != null) && (req.query.admin !== '1')) {
if ((parent.config.settings.maintenancemode != null) && (req.query.loginscreen !== '1')) {
parent.debug('web', 'handleLoginRequest: Server under maintenance.');
render(req, res, getRenderPage((domain.sitestyle == 2) ? 'message2' : 'message', req, domain), getRenderArgs({ titleid: 3, msgid: 13, domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27') }, req, domain));
return;
@ -2552,6 +2552,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (req.session && req.session.userid && obj.users[req.session.userid]) {
const user = obj.users[req.session.userid];
// Check if we are in maintenance mode
if ((parent.config.settings.maintenancemode != null) && (user.siteadmin != 4294967295)) {
req.session.messageid = 115; // Server under maintenance
req.session.loginmode = 1;
res.redirect(domain.url);
return;
}
// If the request has a "meshmessengerid", redirect to MeshMessenger
// This situation happens when you get a push notification for a chat session, but are not logged in.
if (req.query.meshmessengerid != null) {