Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #21291 -- Ensured inactive users cannot reset their passwords

Thanks kz26 for the report and the suggested fix. Refs #19758.
  • Loading branch information...
commit 5f52590368063fc8284e23be492d83ba751f66bf 1 parent 59a8808
@claudep claudep authored
5 django/contrib/auth/
@@ -238,8 +238,9 @@ def save(self, domain_override=None,
from django.core.mail import send_mail
UserModel = get_user_model()
email = self.cleaned_data["email"]
- users = UserModel._default_manager.filter(email__iexact=email)
- for user in users:
+ active_users = UserModel._default_manager.filter(
+ email__iexact=email, is_active=True)
+ for user in active_users:
# Make sure that no email is sent to a user that actually has
# a password marked as unusable
if not user.has_usable_password():
1  django/contrib/auth/tests/
@@ -436,6 +436,7 @@ def test_inactive_user(self):
form = PasswordResetForm({'email': email})
self.assertEqual(len(mail.outbox), 0)
def test_unusable_password(self):
Please sign in to comment.
Something went wrong with that request. Please try again.