1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 06:22:22 +00:00

Admins can declare an email as valid

This commit is contained in:
Yohann D'ANELLO 2020-12-28 21:42:01 +01:00
parent c86ff67884
commit 95fec7c0da
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -203,7 +203,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"]
@ -214,7 +214,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"]