8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Allow users in the STATE_EMAIL_NOT_YET_CONFIRMED to reset their password

This commit is contained in:
Jean-Romain Garnier 2020-04-17 16:32:37 +02:00 committed by Gabriel Detraz
parent 14fe70c762
commit 811e527232
2 changed files with 2 additions and 1 deletions

View file

@ -113,6 +113,7 @@ class PassForm(FormRevMixin, FieldPermissionFormMixin, forms.ModelForm):
"""Changement du mot de passe""" """Changement du mot de passe"""
user = super(PassForm, self).save(commit=False) user = super(PassForm, self).save(commit=False)
user.set_password(self.cleaned_data.get("passwd1")) user.set_password(self.cleaned_data.get("passwd1"))
user.state = User.STATE_NOT_YET_ACTIVE
user.set_active() user.set_active()
user.save() user.save()

View file

@ -979,7 +979,7 @@ def reset_password(request):
user = User.objects.get( user = User.objects.get(
pseudo=userform.cleaned_data["pseudo"], pseudo=userform.cleaned_data["pseudo"],
email=userform.cleaned_data["email"], 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: except User.DoesNotExist:
messages.error(request, _("The user doesn't exist.")) messages.error(request, _("The user doesn't exist."))