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

Remove code mort

This commit is contained in:
Gabriel Detraz 2020-04-17 21:15:18 +02:00
parent 9f1c6a57e2
commit c00bb2573b

View file

@ -351,8 +351,6 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
label=_("Force the move?"), initial=False, required=False label=_("Force the move?"), initial=False, required=False
) )
should_send_confirmation_email = False
def clean_email(self): def clean_email(self):
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get( if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get(
"email" "email"
@ -826,7 +824,6 @@ class EMailAddressForm(FormRevMixin, ModelForm):
class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Edit email-related settings""" """Edit email-related settings"""
should_send_confirmation_email = False
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
prefix = kwargs.pop("prefix", self.Meta.model.__name__) prefix = kwargs.pop("prefix", self.Meta.model.__name__)
@ -849,22 +846,6 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
) )
) )
def save(self, commit=True):
"""Update email state if email was changed"""
user = super(EmailSettingsForm, self).save(commit=commit)
if 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.email_state = User.EMAIL_STATE_PENDING
self.should_send_confirmation_email = True
# Always keep the oldest change date
if user.email_change_date is None:
user.email_change_date = timezone.now()
user.save()
class Meta: class Meta:
model = User model = User
fields = ["email", "local_email_enabled", "local_email_redirect"] fields = ["email", "local_email_enabled", "local_email_redirect"]