diff --git a/demo/demodesk/config/settings.py b/demo/demodesk/config/settings.py index 14c54876..84e51398 100644 --- a/demo/demodesk/config/settings.py +++ b/demo/demodesk/config/settings.py @@ -98,6 +98,9 @@ HELPDESK_SUBMIT_A_TICKET_PUBLIC = True # Should the Knowledgebase be enabled? HELPDESK_KB_ENABLED = True +# Allow users to change their passwords +HELPDESK_SHOW_CHANGE_PASSWORD = True + # Instead of showing the public web portal first, # we can instead redirect users straight to the login page. HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = False diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index ad62b9b4..91af82b7 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -77,3 +77,7 @@ Add your custom styles here } #helpdesk-body {padding-top: 100px;} img.brand {padding-right: 30px;} + +div.card-body img { + max-width: 900px; +} diff --git a/helpdesk/templates/helpdesk/navigation-header.html b/helpdesk/templates/helpdesk/navigation-header.html index 44188bfa..a4a80417 100644 --- a/helpdesk/templates/helpdesk/navigation-header.html +++ b/helpdesk/templates/helpdesk/navigation-header.html @@ -49,7 +49,7 @@ {% trans "User Settings" %} {% trans "RSS Feeds" %} {% if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password %} - {% trans "Change password" %} + {% trans "Change password" %} {% endif %} {% if user.is_superuser %} diff --git a/helpdesk/templates/helpdesk/registration/change_password.html b/helpdesk/templates/helpdesk/registration/change_password.html new file mode 100644 index 00000000..6867df0c --- /dev/null +++ b/helpdesk/templates/helpdesk/registration/change_password.html @@ -0,0 +1,51 @@ +{% extends "helpdesk/base.html" %}{% load i18n %} +{% block helpdesk_title %}{% trans "Change password" %}{% endblock %} + +{% block helpdesk_body %} + +

{% trans "Change Password" %}

+ +
{% csrf_token %} +
+{% if form.errors %} +

+ {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+{% endif %} + + +

{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

+ +
+ +
+ {{ form.old_password.errors }} + {{ form.old_password.label_tag }} {{ form.old_password }} +
+ +
+ {{ form.new_password1.errors }} + {{ form.new_password1.label_tag }} {{ form.new_password1 }} + {% if form.new_password1.help_text %} +
{{ form.new_password1.help_text|safe }}
+ {% endif %} +
+ +
+{{ form.new_password2.errors }} + {{ form.new_password2.label_tag }} {{ form.new_password2 }} + {% if form.new_password2.help_text %} +
{{ form.new_password2.help_text|safe }}
+ {% endif %} +
+ +
+ +
+ +
+ +
+
+ +{% endblock helpdesk_body %} diff --git a/helpdesk/templates/helpdesk/registration/change_password_done.html b/helpdesk/templates/helpdesk/registration/change_password_done.html new file mode 100644 index 00000000..e5e1db8b --- /dev/null +++ b/helpdesk/templates/helpdesk/registration/change_password_done.html @@ -0,0 +1,10 @@ +{% extends "helpdesk/base.html" %}{% load i18n %} +{% block helpdesk_title %}{% trans "Change password" %}{% endblock %} + +{% block helpdesk_body %} + +

{% trans "Success!" %}

+ +

{% trans 'Your password was changed.' %}

+ +{% endblock helpdesk_body %} diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 1ed991aa..1377d780 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -203,6 +203,17 @@ urlpatterns += [ template_name='helpdesk/registration/login.html', next_page='../'), name='logout'), + + url(r'^password_change/$', + auth_views.PasswordChangeView.as_view( + template_name='helpdesk/registration/change_password.html', + success_url='./done'), + name='password_change'), + + url(r'^password_change/done$', + auth_views.PasswordChangeDoneView.as_view( + template_name='helpdesk/registration/change_password_done.html',), + name='password_change_done'), ] if helpdesk_settings.HELPDESK_KB_ENABLED: