Enhancement: use custom logo on login page

This commit is contained in:
shamoon 2024-05-19 10:43:12 -07:00
parent 3061c59c06
commit af5fc7775f
3 changed files with 26 additions and 2 deletions

View File

@ -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,
}

View File

@ -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;
}

View File

@ -13,14 +13,21 @@
{% endblock head_title %}
</title>
<link href="{% static 'bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'accounts.css' %}" rel="stylesheet">
<link href="{% static 'base.css' %}" rel="stylesheet">
</head>
<body class="text-center">
<div class="position-absolute top-50 start-50 translate-middle">
<form class="form-accounts" method="post">
{% csrf_token %}
{% if not APP_LOGO %}
{% include "paperless-ngx/snippets/svg_logo.html" with extra_attrs="width='300' class='logo mb-4'" %}
{% else %}
<img src="{{APP_LOGO}}" width="300" class="logo mb-1" />
<div class="d-flex flex-column align-items-end mb-4">
<span class="byline text-uppercase font-monospace">by Paperless-ngx</span>
</div>
{% endif %}
{% for message in messages %}
<div class="alert alert-{{ message.level_tag }}" role="alert">
{{ message }}