8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Require user_edit permission to resend confirmation email

This commit is contained in:
Jean-Romain Garnier 2020-04-17 13:17:18 +02:00 committed by Jean-Romain Garnier
parent 67b03827df
commit 04969abed3

View file

@ -1030,6 +1030,28 @@ def process_passwd(request, req):
)
def process_email(request, req):
"""Process la confirmation de mail, renvoie le formulaire
de validation"""
user = req.user
if request.method == "POST":
with transaction.atomic(), reversion.create_revision():
user.confirm_mail()
user.save()
reversion.set_comment("Email confirmation")
req.delete()
messages.success(request, _("The %s address was confirmed." % user.email))
return redirect(reverse("index"))
return form(
{"email": user.email, "firstname": user.name, "lastname": user.surname},
"users/confirm_email.html",
request
)
@can_edit(User)
def resend_confirmation_email(request, userid):
""" Renvoi du mail de confirmation """
try:
@ -1052,27 +1074,6 @@ def resend_confirmation_email(request, userid):
)
def process_email(request, req):
"""Process la confirmation de mail, renvoie le formulaire
de validation"""
user = req.user
if request.method == "POST":
with transaction.atomic(), reversion.create_revision():
user.confirm_mail()
user.save()
reversion.set_comment("Email confirmation")
req.delete()
messages.success(request, _("The %s address was confirmed." % user.email))
return redirect(reverse("index"))
return form(
{"email": user.email, "firstname": user.name, "lastname": user.surname},
"users/confirm_email.html",
request
)
@login_required
def initial_register(request):
switch_ip = request.GET.get("switch_ip", None)