Prevent password reset for inactive users

This commit is contained in:
Mouse Reeve 2021-09-27 09:29:13 -07:00
parent cfca806af8
commit c399d6edfb

View file

@ -27,7 +27,9 @@ class PasswordResetRequest(View):
"""create a password reset token""" """create a password reset token"""
email = request.POST.get("email") email = request.POST.get("email")
try: try:
user = models.User.objects.get(email=email, email__isnull=False) user = models.User.viewer_aware_objects(request.user).get(
email=email, email__isnull=False
)
except models.User.DoesNotExist: except models.User.DoesNotExist:
data = {"error": _("No user with that email address was found.")} data = {"error": _("No user with that email address was found.")}
return TemplateResponse(request, "password_reset_request.html", data) return TemplateResponse(request, "password_reset_request.html", data)