From 811e527232b27df80e37e59c725c179fb84c98e3 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 17 Apr 2020 16:32:37 +0200 Subject: [PATCH] Allow users in the STATE_EMAIL_NOT_YET_CONFIRMED to reset their password --- users/forms.py | 1 + users/views.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/users/forms.py b/users/forms.py index da833203..8135ed30 100644 --- a/users/forms.py +++ b/users/forms.py @@ -113,6 +113,7 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm): """Changement du mot de passe""" user = super(PassForm, self).save(commit=False) user.set_password(self.cleaned_data.get("passwd1")) + user.state = User.STATE_NOT_YET_ACTIVE user.set_active() user.save() diff --git a/users/views.py b/users/views.py index 36ddefbd..0a4d05f5 100644 --- a/users/views.py +++ b/users/views.py @@ -979,7 +979,7 @@ def reset_password(request): user = User.objects.get( pseudo=userform.cleaned_data["pseudo"], email=userform.cleaned_data["email"], - state__in=[User.STATE_ACTIVE, User.STATE_NOT_YET_ACTIVE], + state__in=[User.STATE_ACTIVE, User.STATE_NOT_YET_ACTIVE, User.STATE_EMAIL_NOT_YET_CONFIRMED], ) except User.DoesNotExist: messages.error(request, _("The user doesn't exist."))