add option 'HELPDESK_SHOW_CHANGE_PASSWORD' so that local users find a link to change their password.

(needs django-registration https://bitbucket.org/ubernostrum/django-registration/).
This commit is contained in:
Andreas Kotowicz 2011-11-24 13:30:45 +01:00
parent d876c1be13
commit 1c3a7a8a7b
3 changed files with 22 additions and 2 deletions

View File

@ -55,6 +55,9 @@ HELPDESK_TRANSLATE_TICKET_COMMENTS = getattr(settings, 'HELPDESK_TRANSLATE_TICKE
# list of languages to offer. if set to false, all default google translate languages will be shown.
HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG = getattr(settings, 'HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG', ["en", "de", "fr", "ru"])
# show link to 'change password' on 'User Settings' page?
HELPDESK_SHOW_CHANGE_PASSWORD = getattr(settings, 'HELPDESK_SHOW_CHANGE_PASSWORD', False)
# allow user to override default layout for 'followups' - work in progress.
HELPDESK_FOLLOWUP_MOD = getattr(settings, 'HELPDESK_FOLLOWUP_MOD', False)

View File

@ -2,10 +2,20 @@
{% block helpdesk_title %}{% trans "Change User Settings" %}{% endblock %}
{% block helpdesk_body %}{% blocktrans %}
{% block helpdesk_body %}
{% if show_password_change_link %}
{% url auth_password_change as password_change_url %}
<h2>Change Password</h2>
<p>
Change your password <a href="{{ password_change_url }}" title="change your password">here</a>.
</p>
{% endif %}
{% blocktrans %}
<h2>User Settings</h2>
<p>Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.</p>{% endblocktrans %}
<p>Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.</p>
{% endblocktrans %}
<form method='post' action='./'>
<fieldset>

View File

@ -1004,9 +1004,16 @@ def user_settings(request):
else:
form = UserSettingsForm(s.settings)
user = User.objects.get(id = request.user.id)
show_password_change_link = 0
# we don't want non-local users to see the 'change password' link.
if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password():
show_password_change_link = 1
return render_to_response('helpdesk/user_settings.html',
RequestContext(request, {
'form': form,
'show_password_change_link': show_password_change_link,
}))
user_settings = staff_member_required(user_settings)