diff --git a/passbook/core/settings.py b/passbook/core/settings.py index 58a58e041..e8102f3b2 100644 --- a/passbook/core/settings.py +++ b/passbook/core/settings.py @@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/2.1/ref/settings/ import importlib import os +from django.contrib import messages + from passbook import __version__ from passbook.lib.config import CONFIG @@ -66,6 +68,16 @@ INSTALLED_APPS = [ 'passbook.tfa', ] +# Message Tag fix for bootstrap CSS Classes +MESSAGE_TAGS = { + messages.DEBUG: 'primary', + messages.INFO: 'info', + messages.SUCCESS: 'success', + messages.WARNING: 'warning', + messages.ERROR: 'danger', +} + + REST_FRAMEWORK = { # Use Django's standard `django.contrib.auth` permissions, # or allow read-only access for unauthenticated users. diff --git a/passbook/core/templates/login/form.html b/passbook/core/templates/login/form.html index e7bdd9ad9..e3a224e88 100644 --- a/passbook/core/templates/login/form.html +++ b/passbook/core/templates/login/form.html @@ -7,6 +7,7 @@

{% trans 'Log In to Your Account' %}

+{% include 'partials/messages.html' %}
{% csrf_token %}
diff --git a/passbook/core/templates/partials/messages.html b/passbook/core/templates/partials/messages.html index 00ae96261..3d4f76f21 100644 --- a/passbook/core/templates/partials/messages.html +++ b/passbook/core/templates/partials/messages.html @@ -4,7 +4,15 @@ - + {% if msg.level_tag == 'danger' %} + + {% elif msg.level_tag == 'warning' %} + + {% elif msg.level_tag == 'success' %} + + {% elif msg.level_tag == 'info' %} + + {% endif %} {{ msg.message|safe }}
{% endfor %}