Fix message icons and show messages on login view
This commit is contained in:
parent
095a5c0268
commit
e9e6f632e3
|
@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from django.contrib import messages
|
||||||
|
|
||||||
from passbook import __version__
|
from passbook import __version__
|
||||||
from passbook.lib.config import CONFIG
|
from passbook.lib.config import CONFIG
|
||||||
|
|
||||||
|
@ -66,6 +68,16 @@ INSTALLED_APPS = [
|
||||||
'passbook.tfa',
|
'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 = {
|
REST_FRAMEWORK = {
|
||||||
# Use Django's standard `django.contrib.auth` permissions,
|
# Use Django's standard `django.contrib.auth` permissions,
|
||||||
# or allow read-only access for unauthenticated users.
|
# or allow read-only access for unauthenticated users.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<header class="login-pf-header">
|
<header class="login-pf-header">
|
||||||
<h1>{% trans 'Log In to Your Account' %}</h1>
|
<h1>{% trans 'Log In to Your Account' %}</h1>
|
||||||
</header>
|
</header>
|
||||||
|
{% include 'partials/messages.html' %}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -4,7 +4,15 @@
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<span class="pficon pficon-close"></span>
|
<span class="pficon pficon-close"></span>
|
||||||
</button>
|
</button>
|
||||||
<span class="pficon pficon-{{ msg.level_tag }}"></span>
|
{% if msg.level_tag == 'danger' %}
|
||||||
|
<span class="pficon pficon-error-circle-o"></span>
|
||||||
|
{% elif msg.level_tag == 'warning' %}
|
||||||
|
<span class="pficon pficon-warning-triangle-o"></span>
|
||||||
|
{% elif msg.level_tag == 'success' %}
|
||||||
|
<span class="pficon pficon-ok"></span>
|
||||||
|
{% elif msg.level_tag == 'info' %}
|
||||||
|
<span class="pficon pficon-info"></span>
|
||||||
|
{% endif %}
|
||||||
<strong>{{ msg.message|safe }}</strong>
|
<strong>{{ msg.message|safe }}</strong>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Reference in New Issue