From af5fc7775f4db3aef39d7d5e3da4a54509c08772 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 19 May 2024 10:43:12 -0700 Subject: [PATCH] Enhancement: use custom logo on login page --- src/documents/context_processors.py | 8 ++++++++ src/documents/static/{accounts.css => base.css} | 9 +++++++++ src/documents/templates/paperless-ngx/base.html | 11 +++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) rename src/documents/static/{accounts.css => base.css} (94%) diff --git a/src/documents/context_processors.py b/src/documents/context_processors.py index 9f8dacfb3..fd2757133 100644 --- a/src/documents/context_processors.py +++ b/src/documents/context_processors.py @@ -1,11 +1,19 @@ from django.conf import settings as django_settings +from paperless.config import GeneralConfig + def settings(request): + general_config = GeneralConfig() + app_logo = django_settings.APP_LOGO + if general_config.app_logo is not None and len(general_config.app_logo) > 0: + app_logo = general_config.app_logo + return { "EMAIL_ENABLED": django_settings.EMAIL_HOST != "localhost" or django_settings.EMAIL_HOST_USER != "", "DISABLE_REGULAR_LOGIN": django_settings.DISABLE_REGULAR_LOGIN, "ACCOUNT_ALLOW_SIGNUPS": django_settings.ACCOUNT_ALLOW_SIGNUPS, "domain": getattr(django_settings, "PAPERLESS_URL", request.get_host()), + "APP_LOGO": app_logo, } diff --git a/src/documents/static/accounts.css b/src/documents/static/base.css similarity index 94% rename from src/documents/static/accounts.css rename to src/documents/static/base.css index 2a1d905f9..d9cb9c606 100644 --- a/src/documents/static/accounts.css +++ b/src/documents/static/base.css @@ -7,6 +7,15 @@ body { --pngx-primary-active: #0c2c10; } +.logo { + height: auto; +} + +.byline { + font-size: 0.6rem; + letter-spacing: 0.1rem; +} + .form-control { --bs-body-bg: #fff; } diff --git a/src/documents/templates/paperless-ngx/base.html b/src/documents/templates/paperless-ngx/base.html index 7a15320fd..9e330ab38 100644 --- a/src/documents/templates/paperless-ngx/base.html +++ b/src/documents/templates/paperless-ngx/base.html @@ -13,14 +13,21 @@ {% endblock head_title %} - +
{% csrf_token %} - {% include "paperless-ngx/snippets/svg_logo.html" with extra_attrs="width='300' class='logo mb-4'" %} + {% if not APP_LOGO %} + {% include "paperless-ngx/snippets/svg_logo.html" with extra_attrs="width='300' class='logo mb-4'" %} + {% else %} + +
+ +
+ {% endif %} {% for message in messages %}