From fca81fe906c906f49ec982928bb54a7b5f4a4b96 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 17 Apr 2020 11:30:17 +0200 Subject: [PATCH] Fix template shown when confirming send an email --- users/views.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/users/views.py b/users/views.py index 5c23932e..29bdb500 100644 --- a/users/views.py +++ b/users/views.py @@ -1032,25 +1032,22 @@ def process_passwd(request, req): def resend_confirmation_email(request, userid): - """ Renvoie du mail de confirmation """ - 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.")) - return redirect(reverse("users:profil", kwargs={"userid": 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.")) - if userform.is_valid(): - 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( - {"email": user.email}, - "users/resend_confirmation_email.html", - request, + {"email": user.email}, "users/resend_confirmation_email.html", request )