diff --git a/demo/demodesk/config/settings.py b/demo/demodesk/config/settings.py index a8366d22..6e99d4f0 100644 --- a/demo/demodesk/config/settings.py +++ b/demo/demodesk/config/settings.py @@ -124,6 +124,8 @@ HELPDESK_SHOW_CHANGE_PASSWORD = True HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = False LOGIN_URL = 'helpdesk:login' LOGIN_REDIRECT_URL = 'helpdesk:home' +# You can also redirect to a specific page after logging out (instead of logout page) +# LOGOUT_REDIRECT_URL = 'helpdesk:home' # Database # - by default, we use SQLite3 for the demo, but you can also diff --git a/docs/install.rst b/docs/install.rst index a72de66a..f486defc 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -162,9 +162,16 @@ errors with trying to create User settings. following to ``settings.py`` to get your Django installation to use the login view included in ``django-helpdesk``:: - LOGIN_URL = '/helpdesk/login/' + LOGIN_URL = 'helpdesk:login' - Alter the URL to suit your installation path. + Alter the view name to suit your installation path. + + You can also add following settings to handle redirects after logging in or out:: + + LOGIN_REDIRECT_URL = 'helpdesk:home' + LOGOUT_REDIRECT_URL = 'helpdesk:home' + + If you don't set ``LOGOUT_REDIRECT_URL``, a logout confirmation page will be displayed. 8. Load initial e-mail templates, otherwise you will not be able to send e-mail:: diff --git a/helpdesk/templates/helpdesk/navigation-header.html b/helpdesk/templates/helpdesk/navigation-header.html index d63dabe0..417a6451 100644 --- a/helpdesk/templates/helpdesk/navigation-header.html +++ b/helpdesk/templates/helpdesk/navigation-header.html @@ -58,7 +58,11 @@ {% trans "System Settings" %} {% endif %} - {% trans "Logout" %} +
{% csrf_token %} + +
{% else %} @@ -80,11 +84,17 @@ {{user.username}} - {% endif %} diff --git a/helpdesk/templates/helpdesk/registration/logged_out.html b/helpdesk/templates/helpdesk/registration/logged_out.html index e7146545..f2d5c2b1 100644 --- a/helpdesk/templates/helpdesk/registration/logged_out.html +++ b/helpdesk/templates/helpdesk/registration/logged_out.html @@ -1,13 +1,25 @@ {% extends "helpdesk/public_base.html" %}{% load i18n %} {% block helpdesk_title %}{% trans "Logged Out" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} - -
-
-

Successfully Logged Out

-

Thanks for being here. Hopefully you've helped resolve a few tickets and made the world a better place.

+{% block helpdesk_body %} + {% blocktrans %} +
+
+

Successfully Logged Out

+

+ Thanks for being here. Hopefully you've helped resolve a few tickets + and made the world a better place. +

+
+ {% endblocktrans %} + +
+ + - -{% endblocktrans %}{% endblock %} +{% endblock %} diff --git a/helpdesk/templates/helpdesk/registration/login.html b/helpdesk/templates/helpdesk/registration/login.html index a6ae234a..f76a493c 100644 --- a/helpdesk/templates/helpdesk/registration/login.html +++ b/helpdesk/templates/helpdesk/registration/login.html @@ -36,7 +36,9 @@
- + {% if next %} + + {% endif %} {% csrf_token %} diff --git a/helpdesk/urls.py b/helpdesk/urls.py index bbccd354..02345389 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -215,7 +215,7 @@ urlpatterns += [ path( "logout/", auth_views.LogoutView.as_view( - template_name="helpdesk/registration/login.html", next_page="../" + template_name="helpdesk/registration/logged_out.html" ), name="logout", ),