diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index d852106..99c80fb 100644
a
|
b
|
from django.contrib.auth.decorators import login_required
|
20 | 20 | from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm, PasswordChangeForm |
21 | 21 | from django.contrib.auth.tokens import default_token_generator |
22 | 22 | from django.contrib.sites.models import get_current_site |
| 23 | from django.contrib import messages |
23 | 24 | |
24 | 25 | |
25 | 26 | @sensitive_post_parameters() |
… |
… |
def password_reset(request, is_admin_site=False,
|
160 | 161 | } |
161 | 162 | if is_admin_site: |
162 | 163 | opts = dict(opts, domain_override=request.get_host()) |
163 | | form.save(**opts) |
164 | | return HttpResponseRedirect(post_reset_redirect) |
| 164 | try: |
| 165 | form.save(**opts) |
| 166 | return HttpResponseRedirect(post_reset_redirect) |
| 167 | except Exception as e: |
| 168 | messages.error(request, "Unable to process your password reset request. Please try again later or contact support.") |
| 169 | return HttpResponseRedirect(resolve_url(settings.LOGIN_URL)) |
| 170 | |
165 | 171 | else: |
166 | 172 | form = password_reset_form() |
167 | 173 | context = { |