8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-20 10:23:12 +00:00

Handle manually switching user state to/from STATE_EMAIL_NOT_YET_CONFIRMED

This commit is contained in:
Jean-Romain Garnier 2020-04-17 12:41:33 +02:00 committed by Jean-Romain Garnier
parent 781c459db3
commit 32a7c80133

View file

@ -638,7 +638,7 @@ class User(
self.ldap_sync() self.ldap_sync()
def state_sync(self): def state_sync(self):
"""Archive, or unarchive, if the user was not active/or archived before""" """Handle archiving/unarchiving, and manually confirming a user's email address"""
if ( if (
self.__original_state != self.STATE_ACTIVE self.__original_state != self.STATE_ACTIVE
and self.state == self.STATE_ACTIVE and self.state == self.STATE_ACTIVE
@ -654,6 +654,16 @@ class User(
and self.state == self.STATE_FULL_ARCHIVE and self.state == self.STATE_FULL_ARCHIVE
): ):
self.full_archive() self.full_archive()
elif (
self.__original_state == self.STATE_EMAIL_NOT_YET_CONFIRMED
and self.state not in [self.STATE_EMAIL_NOT_YET_CONFIRMED, self.STATE_DISABLED]
):
self.email_change_date = None
elif (
self.__original_state != self.STATE_EMAIL_NOT_YET_CONFIRMED
and self.state == self.STATE_EMAIL_NOT_YET_CONFIRMED
):
self.email_change_date = timezone.now()
def ldap_sync( def ldap_sync(
self, base=True, access_refresh=True, mac_refresh=True, group_refresh=False self, base=True, access_refresh=True, mac_refresh=True, group_refresh=False