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

Force le lowercase pour les pseudo des nouveaux utilisateurs

This commit is contained in:
Otthorn 2018-12-08 19:33:40 +01:00
parent 5e4e9e3f76
commit 4b2b684241

View file

@ -323,6 +323,14 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
self.fields['room'].empty_label = _("No room") self.fields['room'].empty_label = _("No room")
self.fields['school'].empty_label = _("Select a school") self.fields['school'].empty_label = _("Select a school")
def clean_pseudo(self):
"""Vérfie que le peusdo est bien en minuscule"""
pseudo = self.cleaned_data.get('pseudo')
if pseudo.islower():
return pseudo
else:
raise forms.ValidationError(_("Your pseudo should be in lowercase."))
def clean_email(self): def clean_email(self):
if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'): if not OptionalUser.objects.first().local_email_domain in self.cleaned_data.get('email'):
return self.cleaned_data.get('email').lower() return self.cleaned_data.get('email').lower()