Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@
]
# The password pages in the admin tool are disabled so that all password
# changes go through our user portal and follow complexity requirements.
if not settings.FEATURES.get('ENABLE_CHANGE_USER_PASSWORD_ADMIN'):
urlpatterns.append(url(r'^admin/auth/user/\d+/password/$', handler404))
urlpatterns.append(url(r'^admin/password_change/$', handler404))
urlpatterns.append(url(r'^admin/auth/user/\d+/password/$', handler404))
urlpatterns.append(url(r'^admin/', include(admin.site.urls)))

# enable entrance exams
Expand Down
19 changes: 12 additions & 7 deletions common/djangoapps/student/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Django admin pages for student app """
from config_models.admin import ConfigurationModelAdmin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -278,13 +279,17 @@ class UserChangeForm(BaseUserChangeForm):
Override the default UserChangeForm such that the password field
does not contain a link to a 'change password' form.
"""
password = ReadOnlyPasswordHashField(
label=_("Password"),
help_text=_(
"Raw passwords are not stored, so there is no way to see this "
"user's password."
),
)
def __init__(self, *args, **kwargs):
super(UserChangeForm, self).__init__(*args, **kwargs)

if not settings.FEATURES.get('ENABLE_CHANGE_USER_PASSWORD_ADMIN'):
self.fields["password"] = ReadOnlyPasswordHashField(
label=_("Password"),
help_text=_(
"Raw passwords are not stored, so there is no way to see this "
"user's password."
),
)


class UserAdmin(BaseUserAdmin):
Expand Down
12 changes: 9 additions & 3 deletions lms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,17 @@

if settings.DEBUG or settings.FEATURES.get('ENABLE_DJANGO_ADMIN_SITE'):
# Jasmine and admin

# The password pages in the admin tool are disabled so that all password
# changes go through our user portal and follow complexity requirements.
# The form to change another user's password is conditionally enabled
# for backwards compatibility.
if not settings.FEATURES.get('ENABLE_CHANGE_USER_PASSWORD_ADMIN'):
urlpatterns += [
url(r'^admin/auth/user/\d+/password/$', handler404),
]
urlpatterns += [
# The password pages in the admin tool are disabled so that all password
# changes go through our user portal and follow complexity requirements.
url(r'^admin/password_change/$', handler404),
url(r'^admin/auth/user/\d+/password/$', handler404),
url(r'^admin/', include(admin.site.urls)),
]

Expand Down