From 6498a20b878015fe8942d0a5ac872d7e9614a378 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 6 Apr 2020 03:58:48 +0200 Subject: [PATCH] A user is active iff the email and the account are validated --- apps/activity/views.py | 1 + apps/registration/views.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/activity/views.py b/apps/activity/views.py index 51e2ebf5..29fbc860 100644 --- a/apps/activity/views.py +++ b/apps/activity/views.py @@ -139,6 +139,7 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView): | Q(name__regex=pattern) | Q(normalized_name__regex=Alias.normalize(pattern)))) \ .filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))\ + .filter(note__noteuser__user__profile__registration_valid=True)\ .distinct("username")[:20] for note in note_qs: note.type = "Adhérent" diff --git a/apps/registration/views.py b/apps/registration/views.py index d5a6be60..b3d4766c 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -86,7 +86,7 @@ class UserValidateView(TemplateView): if user is not None and email_validation_token.check_token(user, token): self.validlink = True - user.is_active = True + user.is_active = user.profile.registration_valid user.profile.email_confirmed = True user.save() user.profile.save() @@ -242,7 +242,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView, return self.form_invalid(form) ret = super().form_valid(form) - user.is_active = True + user.is_active = user.profile.email_confirmed user.profile.registration_valid = True user.profile.soge = soge user.save()