8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Fix template shown when confirming send an email

This commit is contained in:
Jean-Romain Garnier 2020-04-17 11:30:17 +02:00 committed by Gabriel Detraz
parent b190549618
commit c4acc0f6f2

View file

@ -1032,25 +1032,22 @@ def process_passwd(request, req):
def resend_confirmation_email(request, userid): def resend_confirmation_email(request, userid):
""" Renvoie du mail de confirmation """ """ Renvoi du mail de confirmation """
if request.method == "POST":
try: try:
user = User.objects.get( user = User.objects.get(
id=userid, id=userid,
state__in=[User.STATE_EMAIL_NOT_YET_CONFIRMED], 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}))
if userform.is_valid():
user.confirm_email_address_mail(request) user.confirm_email_address_mail(request)
messages.success(request, _("An email to confirm your address was sent.")) messages.success(request, _("An email to confirm your address was sent."))
except User.DoesNotExist:
messages.error(request, _("The user doesn't exist."))
return redirect(reverse("users:profil", kwargs={"userid": userid})) return redirect(reverse("users:profil", kwargs={"userid": userid}))
return form( return form(
{"email": user.email}, {"email": user.email}, "users/resend_confirmation_email.html", request
"users/resend_confirmation_email.html",
request,
) )