From 68c10283681061f1cad721b64685a0f71a5dbfd0 Mon Sep 17 00:00:00 2001 From: "waleed.mujahid" Date: Thu, 29 May 2025 13:42:24 +0500 Subject: [PATCH] feat: add filter to reset password request --- .../core/djangoapps/user_authn/views/password_reset.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openedx/core/djangoapps/user_authn/views/password_reset.py b/openedx/core/djangoapps/user_authn/views/password_reset.py index 321101fb9a18..9a0aa18aa141 100644 --- a/openedx/core/djangoapps/user_authn/views/password_reset.py +++ b/openedx/core/djangoapps/user_authn/views/password_reset.py @@ -21,6 +21,7 @@ from django.utils.translation import gettext_lazy as _ from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie from django.views.decorators.http import require_POST +from edly_features_app.filters import ResetPasswordRequested from edx_ace import ace from edx_ace.recipient import Recipient from eventtracking import tracker @@ -199,6 +200,14 @@ def clean_email(self): # The line below contains the only change, removing is_active=True self.users_cache = User.objects.filter(email__iexact=email) + # EDLYCUSTOM: This filter allows filtering users before resetting password + try: + self.users_cache = ResetPasswordRequested.run_filter( + users=self.users_cache, + ) + except ResetPasswordRequested.PreventResetPassword as exc: + raise forms.ValidationError(str(exc)) from exc + if not self.users_cache and is_secondary_email_feature_enabled(): # Check if user has entered the secondary email. self.users_cache = User.objects.filter(