8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-24 16:03:47 +00:00

verification des extension mail externe et lower des adresses mail pour mieux verifier les doublons

This commit is contained in:
grisel-davy 2018-08-09 23:43:35 +02:00 committed by Gabriel Detraz
parent 62d86be364
commit 351495e7ff

View file

@ -624,6 +624,9 @@ class EMailAddressForm(FormRevMixin, ModelForm):
def clean_local_part(self): def clean_local_part(self):
return self.cleaned_data.get('local_part').lower() return self.cleaned_data.get('local_part').lower()
def clean_local_part(self):
return self.cleaned_data.get('local_part').lower()
class Meta: class Meta:
model = EMailAddress model = EMailAddress
exclude = ['user'] exclude = ['user']
@ -646,6 +649,12 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
else: else:
raise forms.ValidationError("Vous ne pouvez pas utiliser une addresse {}".format(OptionalUser.objects.first().local_email_domain)) raise forms.ValidationError("Vous ne pouvez pas utiliser une addresse {}".format(OptionalUser.objects.first().local_email_domain))
def clean_email(self):
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
return self.cleaned_data.get('email').lower()
else:
raise forms.ValidationError("Vous ne pouvez pas utiliser une addresse {}".format(OptionalUser.objects.first().local_email_domain))
class Meta: class Meta:
model = User model = User
fields = ['email','local_email_enabled', 'local_email_redirect'] fields = ['email','local_email_enabled', 'local_email_redirect']