1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-04 18:46:52 +00:00

Admins can change email validation status

This commit is contained in:
Yohann D'ANELLO 2020-12-27 21:19:09 +01:00
parent 64d471936f
commit eec941c816
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -213,7 +213,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
context["title"] = _("Update user {user}").format(user=str(self.object.registration))
context["registration_form"] = user.registration.form_class(data=self.request.POST or None,
instance=self.object.registration)
if not user.registration.is_admin:
if not self.request.user.registration.is_admin:
if "team" in context["registration_form"].fields:
del context["registration_form"].fields["team"]
del context["registration_form"].fields["email_confirmed"]
@ -224,7 +224,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
user = form.instance
registration_form = user.registration.form_class(data=self.request.POST or None,
instance=self.object.registration)
if not user.registration.is_admin:
if not self.request.user.registration.is_admin:
if "team" in registration_form.fields:
del registration_form.fields["team"]
del registration_form.fields["email_confirmed"]