[FR] White labeling

Fixes #2301
This commit is contained in:
Matthias 2022-04-23 23:38:49 +02:00
parent adfcd42e09
commit 7834171c2a
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 23 additions and 8 deletions

View File

@ -67,6 +67,13 @@ DEMO_MODE = _is_true(get_setting(
CONFIG.get('demo', False) CONFIG.get('demo', False)
)) ))
# user interface customization values
CUSTOMIZE = get_setting(
'INVENTREE_CUSTOMIZE',
CONFIG.get('customize', {}),
{}
)
DOCKER = _is_true(get_setting( DOCKER = _is_true(get_setting(
'INVENTREE_DOCKER', 'INVENTREE_DOCKER',
False False

View File

@ -186,3 +186,6 @@ static_root: '/home/inventree/data/static'
# KEYCLOAK_URL: 'https://keycloak.custom/auth' # KEYCLOAK_URL: 'https://keycloak.custom/auth'
# KEYCLOAK_REALM: 'master' # KEYCLOAK_REALM: 'master'
# customize:
# login_message: |
# InvenTree demo instance - <a href='https://inventree.readthedocs.io/en/latest/demo/'> Click here for login details</a>

View File

@ -509,6 +509,13 @@ def mail_configured():
return bool(settings.EMAIL_HOST) return bool(settings.EMAIL_HOST)
@register.simple_tag()
def inventree_customize(reference, *args, **kwargs):
""" Return customization values for the user interface """
return djangosettings.CUSTOMIZE.get(reference, '')
class I18nStaticNode(StaticNode): class I18nStaticNode(StaticNode):
""" """
custom StaticNode custom StaticNode

View File

@ -1,7 +1,7 @@
{% extends "account/base.html" %} {% extends "account/base.html" %}
{% load inventree_extras %} {% load inventree_extras %}
{% load i18n account socialaccount crispy_forms_tags inventree_extras %} {% load i18n account socialaccount crispy_forms_tags inventree_extras markdownify %}
{% block head_title %}{% trans "Sign In" %}{% endblock %} {% block head_title %}{% trans "Sign In" %}{% endblock %}
@ -10,6 +10,7 @@
{% settings_value 'LOGIN_ENABLE_REG' as enable_reg %} {% settings_value 'LOGIN_ENABLE_REG' as enable_reg %}
{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %} {% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %}
{% settings_value 'LOGIN_ENABLE_SSO' as enable_sso %} {% settings_value 'LOGIN_ENABLE_SSO' as enable_sso %}
{% inventree_customize 'login_message' as login_message %}
{% mail_configured as mail_conf %} {% mail_configured as mail_conf %}
{% inventree_demo_mode as demo %} {% inventree_demo_mode as demo %}
@ -35,19 +36,16 @@ for a account and sign in below:{% endblocktrans %}</p>
{% endif %} {% endif %}
<hr> <hr>
{% if login_message %}
{{ login_message|markdownify }}
<hr>
{% endif %}
<div class="btn-group float-right" role="group"> <div class="btn-group float-right" role="group">
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button> <button class="btn btn-success" type="submit">{% trans "Sign In" %}</button>
</div> </div>
{% if mail_conf and enable_pwd_forgot and not demo %} {% if mail_conf and enable_pwd_forgot and not demo %}
<a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a> <a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>
{% endif %} {% endif %}
{% if demo %}
<p>
<h6>
{% trans "InvenTree demo instance" %} - <a href='https://inventree.readthedocs.io/en/latest/demo/'>{% trans "Click here for login details" %}</a>
</h6>
</p>
{% endif %}
</form> </form>
{% if enable_sso %} {% if enable_sso %}