help: only show help pages if user is logged in

This commit is contained in:
Johannes Keyser 2017-06-05 14:57:22 +02:00 committed by James Valleroy
parent 4f47f4e37d
commit 8ae6fbbd4c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 9 deletions

View File

@ -24,7 +24,6 @@ from apt.cache import Cache
from django.http import Http404 from django.http import Http404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _, ugettext_lazy
from stronghold.decorators import public
from plinth import cfg, __version__ from plinth import cfg, __version__
from plinth.menu import main_menu from plinth.menu import main_menu
@ -42,14 +41,12 @@ def init():
100) 100)
@public
def index(request): def index(request):
"""Serve the index page""" """Serve the index page"""
return TemplateResponse(request, 'help_index.html', return TemplateResponse(request, 'help_index.html',
{'title': _('Documentation and FAQ')}) {'title': _('Documentation and FAQ')})
@public
def about(request): def about(request):
"""Serve the about page""" """Serve the about page"""
cache = Cache() cache = Cache()
@ -63,7 +60,6 @@ def about(request):
return TemplateResponse(request, 'help_about.html', context) return TemplateResponse(request, 'help_about.html', context)
@public
def manual(request): def manual(request):
"""Serve the manual page from the 'doc' directory""" """Serve the manual page from the 'doc' directory"""
try: try:

View File

@ -119,13 +119,13 @@
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{% block mainmenu_right %} {% block mainmenu_right %}
{% if user.is_authenticated %}
<li> <li>
<a href="{% url 'help:index' %}" title="{% trans "Help" %}"> <a href="{% url 'help:index' %}" title="{% trans "Help" %}">
<span class="glyphicon-question-sign glyphicon nav-icon"></span> <span class="glyphicon-question-sign glyphicon nav-icon"></span>
</a> </a>
</li> </li>
{% if user.is_authenticated %}
<li class="dropdown"> <li class="dropdown">
<a href="{% url 'users:edit' user.username %}" <a href="{% url 'users:edit' user.username %}"
class="dropdown-toggle" data-toggle="dropdown" class="dropdown-toggle" data-toggle="dropdown"