From 95fec7c0dafecb8d020f2c09eac3b2c8b25fac43 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 28 Dec 2020 21:42:01 +0100 Subject: [PATCH] Admins can declare an email as valid --- apps/registration/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index 6df0e26..723ccd0 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -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"]