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

Always send confirmation email, except for fully-archived users

This commit is contained in:
Jean-Romain Garnier 2020-04-17 20:50:26 +02:00 committed by Jean-Romain Garnier
parent 1ee4d91721
commit e169b51759

View file

@ -807,15 +807,16 @@ class User(
if self.__original_email == self.email:
return False
# Archived users shouldn't get an email
if self.state not in [self.STATE_ACTIVE, self.STATE_DISABLED, self.STATE_NOT_YET_ACTIVE]:
self.email_state = self.EMAIL_STATE_PENDING
# Fully archived users shouldn't get an email
if self.state != self.STATE_FULL_ARCHIVE:
return False
# Always keep the oldest change date
if self.email_change_date is None:
self.email_change_date = timezone.now()
self.email_state = self.EMAIL_STATE_PENDING
self.confirm_email_address_mail(request)
return True