From 4322540077ffdac6fcf543a31d269fe9e41a4db6 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 17 Apr 2020 11:34:54 +0200 Subject: [PATCH] Fix user referenced before assignment --- users/views.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/users/views.py b/users/views.py index 29bdb500..4ed046f3 100644 --- a/users/views.py +++ b/users/views.py @@ -1033,17 +1033,17 @@ def process_passwd(request, req): def resend_confirmation_email(request, userid): """ Renvoi du mail de confirmation """ - if request.method == "POST": - try: - user = User.objects.get( - id=userid, - state__in=[User.STATE_EMAIL_NOT_YET_CONFIRMED], - ) - user.confirm_email_address_mail(request) - messages.success(request, _("An email to confirm your address was sent.")) - except User.DoesNotExist: - messages.error(request, _("The user doesn't exist.")) + try: + user = User.objects.get( + id=userid, + state__in=[User.STATE_EMAIL_NOT_YET_CONFIRMED], + ) + except User.DoesNotExist: + messages.error(request, _("The user doesn't exist.")) + if request.method == "POST": + user.confirm_email_address_mail(request) + messages.success(request, _("An email to confirm your address was sent.")) return redirect(reverse("users:profil", kwargs={"userid": userid})) return form(