A user is active iff the email and the account are validated

This commit is contained in:
Yohann D'ANELLO 2020-04-06 03:58:48 +02:00
parent 2c3127c746
commit 6498a20b87
2 changed files with 3 additions and 2 deletions

View File

@ -139,6 +139,7 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView):
| Q(name__regex=pattern) | Q(name__regex=pattern)
| Q(normalized_name__regex=Alias.normalize(pattern)))) \ | Q(normalized_name__regex=Alias.normalize(pattern)))) \
.filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))\ .filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))\
.filter(note__noteuser__user__profile__registration_valid=True)\
.distinct("username")[:20] .distinct("username")[:20]
for note in note_qs: for note in note_qs:
note.type = "Adhérent" note.type = "Adhérent"

View File

@ -86,7 +86,7 @@ class UserValidateView(TemplateView):
if user is not None and email_validation_token.check_token(user, token): if user is not None and email_validation_token.check_token(user, token):
self.validlink = True self.validlink = True
user.is_active = True user.is_active = user.profile.registration_valid
user.profile.email_confirmed = True user.profile.email_confirmed = True
user.save() user.save()
user.profile.save() user.profile.save()
@ -242,7 +242,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView,
return self.form_invalid(form) return self.form_invalid(form)
ret = super().form_valid(form) ret = super().form_valid(form)
user.is_active = True user.is_active = user.profile.email_confirmed
user.profile.registration_valid = True user.profile.registration_valid = True
user.profile.soge = soge user.profile.soge = soge
user.save() user.save()