8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 11:53:12 +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 Gabriel Detraz
parent 2793e207c0
commit 32c1f8d50a

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): def resend_confirmation_email(request, userid):
""" Renvoi du mail de confirmation """ """ Renvoi du mail de confirmation """
try: 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 @login_required
def initial_register(request): def initial_register(request):
switch_ip = request.GET.get("switch_ip", None) switch_ip = request.GET.get("switch_ip", None)