mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Require user_edit permission to resend confirmation email
This commit is contained in:
parent
2793e207c0
commit
32c1f8d50a
1 changed files with 22 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue