From d86550e1a339f80debd0578a3a0dc17c3a979d1a Mon Sep 17 00:00:00 2001 From: uzairr Date: Sat, 6 Feb 2021 05:13:02 +0500 Subject: [PATCH] reset-password-success-email --- openedx/core/djangoapps/user_authn/views/password_reset.py | 2 +- .../djangoapps/user_authn/views/tests/test_reset_password.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/user_authn/views/password_reset.py b/openedx/core/djangoapps/user_authn/views/password_reset.py index ef218dca67..bf6c9da8b9 100644 --- a/openedx/core/djangoapps/user_authn/views/password_reset.py +++ b/openedx/core/djangoapps/user_authn/views/password_reset.py @@ -715,10 +715,10 @@ class LogistrationPasswordResetView(APIView): # lint-amnesty, pylint: disable=m } ) user.save() - send_password_reset_success_email(user, request) except ObjectDoesNotExist: err = 'Account recovery process initiated without AccountRecovery instance for user {username}' log.error(err.format(username=user.username)) + send_password_reset_success_email(user, request) except ValidationError as err: AUDIT_LOG.exception("Password validation failed") error_status = { diff --git a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py index 08ab304498..1ab15fac24 100644 --- a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py +++ b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py @@ -824,12 +824,13 @@ class ResetPasswordAPITests(EventTestMixin, CacheIsolationTestCase): new=updated_user.email ) - def test_password_reset_email_sent_on_account_recovery_email(self): + @ddt.data(True, False) + def test_password_reset_email_successfully_sent(self, is_account_recovery): """ Test that with is_account_recovery query param available, password reset email is sent to newly updated email address. """ - post_request = self.create_reset_request(self.uidb36, self.token, True) + post_request = self.create_reset_request(self.uidb36, self.token, is_account_recovery) post_request.user = AnonymousUser() post_request.site = Mock(domain='example.com') reset_view = LogistrationPasswordResetView.as_view()