Skip to content

Commit 7009266

Browse files
feanilclaude
andcommitted
refactor: migrate ENABLE_PASSWORD_RESET_FAILURE_EMAIL off FEATURES-as-dict
Default flips from raising KeyError (`settings.FEATURES['…']` direct subscript, only safe inside an active patch) to False (`getattr` with default) — the flag isn't defined in any env file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent dec4d40 commit 7009266

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

openedx/core/djangoapps/user_authn/views/password_reset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def password_change_request_handler(request):
642642
# If enabled, send an email saying that a password reset was attempted, but that there is
643643
# no user associated with the email
644644
if configuration_helpers.get_value('ENABLE_PASSWORD_RESET_FAILURE_EMAIL',
645-
settings.FEATURES['ENABLE_PASSWORD_RESET_FAILURE_EMAIL']):
645+
settings.ENABLE_PASSWORD_RESET_FAILURE_EMAIL):
646646
site = get_current_site()
647647
message_context = get_base_template_context(site)
648648

openedx/core/djangoapps/user_authn/views/tests/test_password.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from django.contrib.auth import get_user_model
1515
from django.core import mail
1616
from django.core.cache import cache
17-
from django.test import TestCase
17+
from django.test import TestCase, override_settings
1818
from django.test.client import RequestFactory
1919
from django.urls import reverse
2020
from freezegun import freeze_time
@@ -215,7 +215,7 @@ def test_password_change_failure(self):
215215
self._change_password()
216216
self.assertRaises(UserAPIInternalError) # noqa: PT027
217217

218-
@patch.dict(settings.FEATURES, {'ENABLE_PASSWORD_RESET_FAILURE_EMAIL': True})
218+
@override_settings(ENABLE_PASSWORD_RESET_FAILURE_EMAIL=True)
219219
def test_password_reset_failure_email(self):
220220
"""Test that a password reset failure email notification is sent, when enabled."""
221221
# Log the user out

0 commit comments

Comments
 (0)