merge 002b896e45b48c5ca80c3ed3cb8f4a2f921f8af8 (allow password management to be enabled/disabled by the WAGTAIL_PASSWORD_MANAGEMENT_ENABLED setting). Need to apply manually because git chokes on the lack of submodules on the feature/user-account-settings branch.

pull/3/head
Matt Westcott 2014-02-03 15:15:35 +00:00
rodzic ada7961207
commit 49ddbaae90
4 zmienionych plików z 23 dodań i 11 usunięć

Wyświetl plik

@ -17,15 +17,17 @@
</small>
</li>
<li class="row row-flush">
<div class="col6">
<a href="{% url 'wagtailadmin_account_change_password' %}" class="button button-primary">Change password</a>
</div>
{% if show_change_password %}
<li class="row row-flush">
<div class="col6">
<a href="{% url 'wagtailadmin_account_change_password' %}" class="button button-primary">Change password</a>
</div>
<small class="col6">
Change the password you use to log in.
</small>
</li>
<small class="col6">
Change the password you use to log in.
</small>
</li>
{% endif %}
</ul>
</div>
{% endblock %}

Wyświetl plik

@ -36,7 +36,9 @@
{{ form.password.label_tag }}
{{ form.password }}
</div>
<p class="help"><a href="{% url 'django.contrib.auth.views.password_reset' %}">Forgotten it?</a></p>
{% if show_password_reset %}
<p class="help"><a href="{% url 'django.contrib.auth.views.password_reset' %}">Forgotten it?</a></p>
{% endif %}
</li>
{% comment %}
Removed until functionality exists

Wyświetl plik

@ -1,8 +1,13 @@
from django.conf.urls import patterns, url
from django.conf import settings
from wagtail.wagtailadmin.forms import LoginForm, PasswordResetForm
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/$', 'login', {'template_name': 'wagtailadmin/login.html', 'authentication_form': LoginForm}),
url(r'^login/$', 'login', {
'template_name': 'wagtailadmin/login.html',
'authentication_form': LoginForm,
'extra_context': {'show_password_reset': getattr(settings, 'WAGTAIL_PASSWORD_MANAGEMENT_ENABLED', True)},
}),
url(r'^logout/$', 'logout', {'next_page': '/admin/login/'}),
# Password reset

Wyświetl plik

@ -1,10 +1,13 @@
from django.conf import settings
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.forms import SetPasswordForm
def account(request):
return render(request, 'wagtailadmin/account/account.html')
return render(request, 'wagtailadmin/account/account.html', {
'show_change_password': getattr(settings, 'WAGTAIL_PASSWORD_MANAGEMENT_ENABLED', True) and request.user.has_usable_password(),
})
def change_password(request):