Ticket #20866: django_20866.patch

File django_20866.patch, 1.2 KB (added by ezra, 11 years ago)

small patch to catch the excpetion

  • django/contrib/auth/views.py

    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  
    2020from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm, PasswordChangeForm
    2121from django.contrib.auth.tokens import default_token_generator
    2222from django.contrib.sites.models import get_current_site
     23from django.contrib import messages
    2324
    2425
    2526@sensitive_post_parameters()
    def password_reset(request, is_admin_site=False,  
    160161            }
    161162            if is_admin_site:
    162163                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
    165171    else:
    166172        form = password_reset_form()
    167173    context = {
Back to Top