Update login page

This commit is contained in:
Jeremy Stretch 2023-12-29 16:49:29 -05:00
parent 69f849d4e6
commit 4e18897c62

View File

@ -5,77 +5,72 @@
{% load i18n %} {% load i18n %}
{% block layout %} {% block layout %}
<main class="login-container text-center">
{# Login banner #} <div class="page page-center">
{% if config.BANNER_LOGIN %} <div class="container container-tight py-4">
<div class="mw-90 mw-md-75 mw-lg-80 mw-xl-75 mw-xxl-50">
{{ config.BANNER_LOGIN|safe }} {# NetBox logo #}
<div class="text-center mb-4">
<img src="{% static 'netbox_logo.svg' %}" height="80" alt="{% trans "NetBox logo" %}" />
</div> </div>
{% endif %}
{# Login form errors #} {# Login banner #}
{% if form.non_field_errors %} {% if config.BANNER_LOGIN %}
<div class="alert alert-danger" role="alert"> <div class="mb-5 text-center">
<h4 class="alert-heading">{% trans "Errors" %}</h4> {{ config.BANNER_LOGIN|safe }}
<p> </div>
{{ form.non_field_errors }} {% endif %}
</p>
</div>
{% endif %}
{# Login form #} {# Login form errors #}
<div class="form-login"> {% if form.non_field_errors %}
<form action="{% url 'login' %}" method="post"> <div class="alert alert-danger" role="alert">
{% csrf_token %} <h4 class="alert-heading">{% trans "Errors" %}</h4>
<p>
{{ form.non_field_errors }}
</p>
</div>
{% endif %}
{# Logo #} <div class="card card-md">
<div class="mb-4"> <div class="card-body">
<img src="{% static 'netbox_logo.svg' %}" height="80" alt="{% trans "NetBox logo" %}" /> <h3 class="text-center mb-4">Log In</h3>
{# Login form #}
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
{# Set post-login URL #}
{% if 'next' in request.GET %}
<input type="hidden" name="next" value="{{ request.GET.next }}" />
{% elif 'next' in request.POST %}
<input type="hidden" name="next" value="{{ request.POST.next }}" />
{% endif %}
{{ form }}
<button type="submit" class="btn btn-primary btn-lg w-100 mt-4">
{% trans "Sign In" %}
</button>
</form>
</div> </div>
{# Set post-login URL #} {# SSO login #}
{% if 'next' in request.GET %} {% if auth_backends %}
<input type="hidden" name="next" value="{{ request.GET.next }}" /> <div class="hr-text">or</div>
{% endif %} {% if 'next' in request.POST %} <div class="card-body">
<input type="hidden" name="next" value="{{ request.POST.next }}" /> <h6 class="mt-4 mb-3">{% trans "Or use a single sign-on (SSO) provider" %}:</h6>
{% for backend in auth_backends %}
<h5>
{% if backend.icon_name %}<i class="mdi mdi-{{ backend.icon_name }}"></i>{% endif %}
<a href="{{ backend.url }}" class="my-2">{{ backend.display_name }}</a>
</h5>
{% endfor %}
</div>
{% endif %} {% endif %}
{{ form.username }}
{{ form.password }}
<button type="submit" class="btn btn-primary btn-lg w-100 mt-4">
{% trans "Sign In" %}
</button>
</form>
</div>
{% if auth_backends %}
<h6 class="mt-4 mb-3">{% trans "Or use a single sign-on (SSO) provider" %}:</h6>
{% for backend in auth_backends %}
<h5>
{% if backend.icon_name %}<i class="mdi mdi-{{ backend.icon_name }}"></i>{% endif %}
<a href="{{ backend.url }}" class="my-2">{{ backend.display_name }}</a>
</h5>
{% endfor %}
{% endif %}
</main>
{# Page footer #}
<footer class="footer container-fluid login-footer p-3">
<div class="row align-items-center w-100">
<div class="col-2 col-md-1 mb-0">
<button type="button" class="btn btn-sm color-mode-toggle" title="{% trans "Toggle Color Mode" %}">
<i class="color-mode-icon mdi mdi-lightbulb"></i>&nbsp;
</button>
</div>
<div class="col-1 col-md-auto mb-0"></div>
<div class="col text-end mb-0">
<small class="text-muted">
{{ settings.HOSTNAME }} (v{{ settings.VERSION }})
</small>
</div> </div>
</div> </div>
</footer> </div>
{% endblock layout %} {% endblock layout %}