Skip to content

feat: add filter to reset password request #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop-sumac
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions openedx/core/djangoapps/user_authn/views/password_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Loading