Merge pull request #2617 from overleaf/ho-open-site-for-admins

allow site to be accessible to admins when closed

GitOrigin-RevId: 71bdf329ce2a4e41533b2a65f45190277ea72dbb
This commit is contained in:
Timothée Alby 2020-02-20 11:08:08 -05:00 committed by Copybot
parent 98f031e9aa
commit b94e1791e0
2 changed files with 8 additions and 0 deletions

View file

@ -182,6 +182,11 @@ if (app.get('env') === 'production') {
webRouter.use(function(req, res, next) { webRouter.use(function(req, res, next) {
if (Settings.siteIsOpen) { if (Settings.siteIsOpen) {
next() next()
} else if (
AuthenticationController.getSessionUser(req) &&
AuthenticationController.getSessionUser(req).isAdmin
) {
next()
} else { } else {
res.status(503) res.status(503)
res.render('general/closed', { title: 'maintenance' }) res.render('general/closed', { title: 'maintenance' })

View file

@ -23,6 +23,9 @@ block content
- if(typeof(suppressSystemMessages) == "undefined") - if(typeof(suppressSystemMessages) == "undefined")
script. script.
window.systemMessages = !{StringHelper.stringifyJsonForScript(systemMessages)}; window.systemMessages = !{StringHelper.stringifyJsonForScript(systemMessages)};
- if(settings.siteIsOpen == false && getSessionUser() && getSessionUser().isAdmin)
script.
window.systemMessages.push({content: "SITE IS CLOSED TO PUBLIC. OPEN ONLY FOR SITE ADMINS", _id:"siteclosed"})
.system-messages( .system-messages(
ng-cloak ng-cloak