mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Closes #1485: Added LOGIN_BANNER configuration setting to display a banner on the login page
This commit is contained in:
parent
b84b526a43
commit
81df837a33
@ -17,7 +17,7 @@ ADMINS = [
|
|||||||
|
|
||||||
## BANNER_BOTTOM
|
## BANNER_BOTTOM
|
||||||
|
|
||||||
Setting these variables will display content in a banner at the top and/or bottom of the page, respectively. To replicate the content of the top banner in the bottom banner, set:
|
Setting these variables will display content in a banner at the top and/or bottom of the page, respectively. HTML is allowed. To replicate the content of the top banner in the bottom banner, set:
|
||||||
|
|
||||||
```
|
```
|
||||||
BANNER_TOP = 'Your banner text'
|
BANNER_TOP = 'Your banner text'
|
||||||
@ -26,6 +26,12 @@ BANNER_BOTTOM = BANNER_TOP
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## BANNER_LOGIN
|
||||||
|
|
||||||
|
The value of this variable will be displayed on the login page above the login form. HTML is allowed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## BASE_PATH
|
## BASE_PATH
|
||||||
|
|
||||||
Default: None
|
Default: None
|
||||||
|
@ -38,11 +38,14 @@ ADMINS = [
|
|||||||
# ['John Doe', 'jdoe@example.com'],
|
# ['John Doe', 'jdoe@example.com'],
|
||||||
]
|
]
|
||||||
|
|
||||||
# Optionally display a persistent banner at the top and/or bottom of every page. To display the same content in both
|
# Optionally display a persistent banner at the top and/or bottom of every page. HTML is allowed. To display the same
|
||||||
# banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP.
|
# content in both banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP.
|
||||||
BANNER_TOP = ''
|
BANNER_TOP = ''
|
||||||
BANNER_BOTTOM = ''
|
BANNER_BOTTOM = ''
|
||||||
|
|
||||||
|
# Text to include on the login page above the login form. HTML is allowed.
|
||||||
|
BANNER_LOGIN = ''
|
||||||
|
|
||||||
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
|
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
|
||||||
# BASE_PATH = 'netbox/'
|
# BASE_PATH = 'netbox/'
|
||||||
BASE_PATH = ''
|
BASE_PATH = ''
|
||||||
|
@ -29,8 +29,9 @@ for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:
|
|||||||
|
|
||||||
# Import optional configuration parameters
|
# Import optional configuration parameters
|
||||||
ADMINS = getattr(configuration, 'ADMINS', [])
|
ADMINS = getattr(configuration, 'ADMINS', [])
|
||||||
BANNER_BOTTOM = getattr(configuration, 'BANNER_BOTTOM', False)
|
BANNER_BOTTOM = getattr(configuration, 'BANNER_BOTTOM', '')
|
||||||
BANNER_TOP = getattr(configuration, 'BANNER_TOP', False)
|
BANNER_LOGIN = getattr(configuration, 'BANNER_LOGIN', '')
|
||||||
|
BANNER_TOP = getattr(configuration, 'BANNER_TOP', '')
|
||||||
BASE_PATH = getattr(configuration, 'BASE_PATH', '')
|
BASE_PATH = getattr(configuration, 'BASE_PATH', '')
|
||||||
if BASE_PATH:
|
if BASE_PATH:
|
||||||
BASE_PATH = BASE_PATH.strip('/') + '/' # Enforce trailing slash only
|
BASE_PATH = BASE_PATH.strip('/') + '/' # Enforce trailing slash only
|
||||||
|
@ -2,8 +2,13 @@
|
|||||||
{% load form_helpers %}
|
{% load form_helpers %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row" style="margin-top: 150px;">
|
<div class="row" style="margin-top: {% if settings.BANNER_LOGIN %}100{% else %}150{% endif %}px;">
|
||||||
<div class="col-sm-4 col-sm-offset-4">
|
<div class="col-sm-4 col-sm-offset-4">
|
||||||
|
{% if settings.BANNER_LOGIN %}
|
||||||
|
<div style="margin-bottom: 25px">
|
||||||
|
{{ settings.BANNER_LOGIN|safe }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if form.non_field_errors %}
|
{% if form.non_field_errors %}
|
||||||
<div class="panel panel-danger">
|
<div class="panel panel-danger">
|
||||||
<div class="panel-heading"><strong>Errors</strong></div>
|
<div class="panel-heading"><strong>Errors</strong></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user