mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Fix wrong email showing up when editing user
This commit is contained in:
parent
d00ecd098e
commit
148fa3ec98
1 changed files with 2 additions and 6 deletions
|
@ -330,11 +330,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
|||
self.fields["room"].label = _("Room")
|
||||
self.fields["room"].empty_label = _("No room")
|
||||
self.fields["school"].empty_label = _("Select a school")
|
||||
|
||||
if not kwargs["user"].is_anonymous():
|
||||
self.initial["email"] = kwargs["user"].email
|
||||
else:
|
||||
self.initial["email"] = None
|
||||
self.is_anon = kwargs["user"].is_anonymous()
|
||||
|
||||
class Meta:
|
||||
model = Adherent
|
||||
|
@ -387,7 +383,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
|||
"""On met à jour l'état de l'utilisateur en fonction de son mail"""
|
||||
user = super(AdherentForm, self).save(commit=commit)
|
||||
|
||||
if self.initial["email"] is not None and user.email != self.initial["email"]:
|
||||
if not self.is_anon and self.initial["email"] and user.email != self.initial["email"]:
|
||||
# Send a confirmation email
|
||||
if user.state in [User.STATE_ACTIVE, User.STATE_DISABLED, User.STATE_NOT_YET_ACTIVE, User.STATE_EMAIL_NOT_YET_CONFIRMED]:
|
||||
user.state = User.STATE_EMAIL_NOT_YET_CONFIRMED
|
||||
|
|
Loading…
Reference in a new issue