Remove PasswordHistory
This is a feature that has been deprecated and can be safely removed. DEPR-7
This commit is contained in:
@@ -57,7 +57,6 @@ from student.models import (
|
||||
CourseEnrollment,
|
||||
CourseEnrollmentAllowed,
|
||||
ManualEnrollmentAudit,
|
||||
PasswordHistory,
|
||||
PendingEmailChange,
|
||||
PendingNameChange,
|
||||
Registration,
|
||||
@@ -1533,7 +1532,6 @@ class TestLMSAccountRetirementPost(RetirementTestCase, ModuleStoreTestCase):
|
||||
|
||||
# other setup
|
||||
PendingNameChange.objects.create(user=self.test_user, new_name=self.pii_standin, rationale=self.pii_standin)
|
||||
PasswordHistory.objects.create(user=self.test_user, password=self.pii_standin)
|
||||
|
||||
# setup for doing POST from test client
|
||||
self.headers = build_jwt_headers(self.test_superuser)
|
||||
@@ -1563,7 +1561,6 @@ class TestLMSAccountRetirementPost(RetirementTestCase, ModuleStoreTestCase):
|
||||
self.assertEqual(RevisionPluginRevision.objects.get(user=self.test_user).ip_address, None)
|
||||
self.assertEqual(ArticleRevision.objects.get(user=self.test_user).ip_address, None)
|
||||
self.assertFalse(PendingNameChange.objects.filter(user=self.test_user).exists())
|
||||
self.assertEqual(PasswordHistory.objects.get(user=self.test_user).password, '')
|
||||
|
||||
self.assertEqual(
|
||||
ManualEnrollmentAudit.objects.get(
|
||||
|
||||
@@ -47,7 +47,6 @@ from openedx.core.lib.api.parsers import MergePatchParser
|
||||
from student.models import (
|
||||
CourseEnrollment,
|
||||
ManualEnrollmentAudit,
|
||||
PasswordHistory,
|
||||
PendingNameChange,
|
||||
CourseEnrollmentAllowed,
|
||||
LoginFailures,
|
||||
@@ -825,7 +824,6 @@ class LMSAccountRetirementView(ViewSet):
|
||||
RevisionPluginRevision.retire_user(retirement.user)
|
||||
ArticleRevision.retire_user(retirement.user)
|
||||
PendingNameChange.delete_by_user_value(retirement.user, field='user')
|
||||
PasswordHistory.retire_user(retirement.user.id)
|
||||
ManualEnrollmentAudit.retire_manual_enrollments(retirement.user, retirement.retired_email)
|
||||
|
||||
CreditRequest.retire_user(retirement)
|
||||
|
||||
@@ -26,10 +26,7 @@ from openedx.core.djangoapps.password_policy import compliance as password_polic
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.util.user_messages import PageLevelMessages
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from student.models import (
|
||||
LoginFailures,
|
||||
PasswordHistory,
|
||||
)
|
||||
from student.models import LoginFailures
|
||||
from student.views import send_reactivation_email_for_user
|
||||
from student.forms import send_password_reset_email_for_user
|
||||
from track import segment
|
||||
@@ -134,16 +131,6 @@ def _check_excessive_login_attempts(user):
|
||||
'to excessive login failures. Try again later.'))
|
||||
|
||||
|
||||
def _check_forced_password_reset(user):
|
||||
"""
|
||||
See if the user must reset his/her password due to any policy settings
|
||||
"""
|
||||
if user and PasswordHistory.should_user_reset_password_now(user):
|
||||
raise AuthFailedError(_('Your password has expired due to password policy on this account. You must '
|
||||
'reset your password before you can log in again. Please click the '
|
||||
'"Forgot Password" link on this page to reset your password before logging in again.'))
|
||||
|
||||
|
||||
def _enforce_password_policy_compliance(request, user):
|
||||
try:
|
||||
password_policy_compliance.enforce_compliance_on_login(user, request.POST.get('password'))
|
||||
@@ -359,7 +346,6 @@ def login_user(request):
|
||||
|
||||
_check_shib_redirect(email_user)
|
||||
_check_excessive_login_attempts(email_user)
|
||||
_check_forced_password_reset(email_user)
|
||||
|
||||
possibly_authenticated_user = email_user
|
||||
|
||||
|
||||
@@ -110,8 +110,7 @@ class LoginTest(CacheIsolationTestCase):
|
||||
value='Email or password is incorrect')
|
||||
self._assert_audit_log(mock_audit_log, 'warning', [u'Login failed', u'Unknown user email', nonexistent_email])
|
||||
|
||||
@patch.dict("django.conf.settings.FEATURES", {'ADVANCED_SECURITY': True})
|
||||
def test_login_fail_incorrect_email_with_advanced_security(self):
|
||||
def test_login_fail_incorrect_email(self):
|
||||
nonexistent_email = u'not_a_user@edx.org'
|
||||
response, mock_audit_log = self._login_response(
|
||||
nonexistent_email,
|
||||
|
||||
Reference in New Issue
Block a user