From 5207a2ab3c203cbc1bbd493d72f747229ffcbd17 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 30 Oct 2021 12:20:08 +0100 Subject: [PATCH] Setting custom background for login screen --- webapp_login.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webapp_login.py b/webapp_login.py index 97e54811c..786112182 100644 --- a/webapp_login.py +++ b/webapp_login.py @@ -13,6 +13,7 @@ from shutil import copyfile from utils import getConfigParam from utils import noOfAccounts from utils import getNicknameValidationPattern +from webapp_utils import setCustomBackground from webapp_utils import htmlHeaderWithWebsiteMarkup from webapp_utils import htmlFooter from webapp_utils import htmlKeyboardNavigation @@ -92,10 +93,7 @@ def htmlLogin(cssCache: {}, translate: {}, textModeLogo = getTextModeLogo(baseDir) textModeLogoHtml = htmlKeyboardNavigation(textModeLogo, {}, {}) - if os.path.isfile(baseDir + '/accounts/login-background-custom.jpg'): - if not os.path.isfile(baseDir + '/accounts/login-background.jpg'): - copyfile(baseDir + '/accounts/login-background-custom.jpg', - baseDir + '/accounts/login-background.jpg') + backgroundExt = setCustomBackground(baseDir, 'login-background-custom') if accounts > 0: loginText = \ @@ -155,6 +153,11 @@ def htmlLogin(cssCache: {}, translate: {}, htmlHeaderWithWebsiteMarkup(cssFilename, instanceTitle, httpPrefix, domain, systemLanguage) + if backgroundExt: + loginForm = loginForm.replace('"login-background.jpg"', + '"login-background-custom.' + + backgroundExt + '"') + nicknamePattern = getNicknameValidationPattern() instanceTitle = getConfigParam(baseDir, 'instanceTitle') loginForm += \