8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +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 Gabriel Detraz
parent bf69f71b9e
commit d4f13f8832

View file

@ -638,7 +638,7 @@ class User(
self.ldap_sync()
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 (
self.__original_state != self.STATE_ACTIVE
and self.state == self.STATE_ACTIVE
@ -654,6 +654,16 @@ class User(
and self.state == self.STATE_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(
self, base=True, access_refresh=True, mac_refresh=True, group_refresh=False