mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
verification des extension mail externe et lower des adresses mail pour mieux verifier les doublons
This commit is contained in:
parent
740843975a
commit
84764ce51b
1 changed files with 22 additions and 0 deletions
|
@ -138,6 +138,12 @@ class UserCreationForm(FormRevMixin, forms.ModelForm):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(UserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(UserCreationForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
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("You can't use an internal address as your external address.")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
fields = ('pseudo', 'surname', 'email')
|
fields = ('pseudo', 'surname', 'email')
|
||||||
|
@ -308,6 +314,12 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
self.fields['room'].empty_label = "Pas de chambre"
|
self.fields['room'].empty_label = "Pas de chambre"
|
||||||
self.fields['school'].empty_label = "Séléctionner un établissement"
|
self.fields['school'].empty_label = "Séléctionner un établissement"
|
||||||
|
|
||||||
|
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 = Adherent
|
model = Adherent
|
||||||
fields = [
|
fields = [
|
||||||
|
@ -323,6 +335,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
'gpg_fingerprint'
|
'gpg_fingerprint'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def clean_telephone(self):
|
def clean_telephone(self):
|
||||||
"""Verifie que le tel est présent si 'option est validée
|
"""Verifie que le tel est présent si 'option est validée
|
||||||
dans preferences"""
|
dans preferences"""
|
||||||
|
@ -608,6 +621,9 @@ class EMailAddressForm(FormRevMixin, ModelForm):
|
||||||
self.fields['local_part'].label = "Local part of the email"
|
self.fields['local_part'].label = "Local part of the email"
|
||||||
self.fields['local_part'].help_text = "Can't contain @"
|
self.fields['local_part'].help_text = "Can't contain @"
|
||||||
|
|
||||||
|
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']
|
||||||
|
@ -631,6 +647,12 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
"Enable the use of the local email account"
|
"Enable the use of the local email account"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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_redirect', 'local_email_enabled']
|
fields = ['email', 'local_email_redirect', 'local_email_enabled']
|
||||||
|
|
Loading…
Reference in a new issue