Merge 0.2.15 bugfixes

This commit is contained in:
Garret Wassermann 2019-03-09 19:00:06 -05:00
commit 519236c288
6 changed files with 80 additions and 1 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -49,7 +49,7 @@
<a class="dropdown-item" href="{% url 'helpdesk:user_settings' %}"><i class="fas fa-fw fa-user-cog"></i> {% trans "User Settings" %}</a>
<a class="dropdown-item" href='{% url 'helpdesk:rss_index' %}'><i class="fas fa-fw fa-rss-square"></i> {% trans "RSS Feeds" %}</a>
{% if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password %}
<a class="dropdown-item" href="{% url 'auth_password_change' %}"><i class="fas fa-fw fa-user-secret"></i> {% trans "Change password" %}</a>
<a class="dropdown-item" href="{% url 'helpdesk:password_change' %}"><i class="fas fa-fw fa-user-secret"></i> {% trans "Change password" %}</a>
{% endif %}
<div class="dropdown-divider"></div>
{% if user.is_superuser %}

View File

@ -0,0 +1,51 @@
{% extends "helpdesk/base.html" %}{% load i18n %}
{% block helpdesk_title %}{% trans "Change password" %}{% endblock %}
{% block helpdesk_body %}
<h3>{% trans "Change Password" %}</h3>
<form method="post">{% csrf_token %}
<div>
{% if form.errors %}
<p class="errornote">
{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
</p>
{% endif %}
<p>{% 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." %}</p>
<fieldset class="module aligned wide">
<div class="form-row">
{{ form.old_password.errors }}
{{ form.old_password.label_tag }} {{ form.old_password }}
</div>
<div class="form-row">
{{ form.new_password1.errors }}
{{ form.new_password1.label_tag }} {{ form.new_password1 }}
{% if form.new_password1.help_text %}
<div class="help">{{ form.new_password1.help_text|safe }}</div>
{% endif %}
</div>
<div class="form-row">
{{ form.new_password2.errors }}
{{ form.new_password2.label_tag }} {{ form.new_password2 }}
{% if form.new_password2.help_text %}
<div class="help">{{ form.new_password2.help_text|safe }}</div>
{% endif %}
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% trans 'Change my password' %}" class="default">
</div>
</div>
</form>
{% endblock helpdesk_body %}

View File

@ -0,0 +1,10 @@
{% extends "helpdesk/base.html" %}{% load i18n %}
{% block helpdesk_title %}{% trans "Change password" %}{% endblock %}
{% block helpdesk_body %}
<h3>{% trans "Success!" %}</h3>
<p>{% trans 'Your password was changed.' %}</p>
{% endblock helpdesk_body %}

View File

@ -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: