diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html b/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html
index 92fb8f585e..93326b3ac7 100644
--- a/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html
@@ -17,15 +17,17 @@
-
-
+ {% if show_change_password %}
+
+
-
- Change the password you use to log in.
-
-
+
+ Change the password you use to log in.
+
+
+ {% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/login.html b/wagtail/wagtailadmin/templates/wagtailadmin/login.html
index d902dd586e..31c087942e 100644
--- a/wagtail/wagtailadmin/templates/wagtailadmin/login.html
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/login.html
@@ -36,7 +36,9 @@
{{ form.password.label_tag }}
{{ form.password }}
- Forgotten it?
+ {% if show_password_reset %}
+ Forgotten it?
+ {% endif %}
{% comment %}
Removed until functionality exists
diff --git a/wagtail/wagtailadmin/urls.py b/wagtail/wagtailadmin/urls.py
index ae0979d13c..8690f6a636 100644
--- a/wagtail/wagtailadmin/urls.py
+++ b/wagtail/wagtailadmin/urls.py
@@ -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
diff --git a/wagtail/wagtailadmin/views/account.py b/wagtail/wagtailadmin/views/account.py
index cc05156979..dccbf2d459 100644
--- a/wagtail/wagtailadmin/views/account.py
+++ b/wagtail/wagtailadmin/views/account.py
@@ -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):