Browse Source

Fixes #109: Hide navbar for anonymous users when LOGIN_REQUIRED = True

Jeremy Stretch 8 years ago
parent
commit
3ea12c646a
1 changed files with 5 additions and 3 deletions
  1. 5 3
      netbox/templates/_base.html

+ 5 - 3
netbox/templates/_base.html

@@ -22,6 +22,7 @@
                 <a class="navbar-brand" href="/">NetBox</a>
             </div>
             <div id="navbar" class="navbar-collapse collapse">
+                {% if request.user.is_authenticated or not settings.LOGIN_REQUIRED %}
                 <ul class="nav navbar-nav">
                     <li class="dropdown{% if request.path|startswith:'/dcim/sites/' %} active{% endif %}">
                         {% if perms.dcim.add_site %}
@@ -207,11 +208,12 @@
                         </li>
                     {% endif %}
                 </ul>
+                {% endif %}
                 <ul class="nav navbar-nav navbar-right">
-                    {% if request.user.is_staff %}
-                        <li><a href="{% url 'admin:index' %}"><i class="glyphicon glyphicon-cog" aria-hidden="true"></i> Admin</a></li>
-                    {% endif %}
                     {% if request.user.is_authenticated %}
+                        {% if request.user.is_staff %}
+                            <li><a href="{% url 'admin:index' %}"><i class="glyphicon glyphicon-cog" aria-hidden="true"></i> Admin</a></li>
+                        {% endif %}
                         <li><a href="{% url 'users:profile' %}"><i class="glyphicon glyphicon-user" aria-hidden="true"></i> Profile</a></li>
                         <li><a href="{% url 'logout' %}"><i class="glyphicon glyphicon-log-out" aria-hidden="true"></i> Log out</a></li>
                     {% else %}