fix navbar showing user info even when not logged in

This commit is contained in:
Nick Sweeting 2021-04-06 00:44:01 -04:00
parent 68a506e1a7
commit 4b098bea15

View file

@ -9,14 +9,18 @@
<a href="{% url 'public-index' %}">Public</a> |
<a href="/admin/">Admin</a>
&nbsp; &nbsp;
{% block welcome-msg %}
{% trans 'User' %}
<strong>{% firstof user.get_short_name user.get_username %}</strong> &nbsp; &nbsp;
{% endblock %}
{% block userlinks %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">Account</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
{% endblock %}
{% if user.is_authenticated %}
{% block welcome-msg %}
{% trans 'User' %}
<strong>{% firstof user.get_short_name user.get_username %}</strong> &nbsp; &nbsp;
{% endblock %}
{% block userlinks %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">Account</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
{% endblock %}
{% else %}
<a href="{% url 'admin:login' %}">{% trans 'Log in' %}</a>
{% endif %}
</div>