mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
parent
806962cda5
commit
bb3e7a0449
@ -30,12 +30,8 @@ class RegistrationForm(forms.Form):
|
|||||||
if ' ' in self.cleaned_data['username']:
|
if ' ' in self.cleaned_data['username']:
|
||||||
raise forms.ValidationError('Username cannot contain a space')
|
raise forms.ValidationError('Username cannot contain a space')
|
||||||
|
|
||||||
# We attempt to get the user object if we succeed we know email as been used
|
if User.objects.filter(email=self.cleaned_data['email']).count() >= 1:
|
||||||
try:
|
|
||||||
User.objects.get(email=self.cleaned_data['email'])
|
|
||||||
raise forms.ValidationError('Email as already been used')
|
raise forms.ValidationError('Email as already been used')
|
||||||
except User.DoesNotExist:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not re.match("^\w+$", self.cleaned_data['username']):
|
if not re.match("^\w+$", self.cleaned_data['username']):
|
||||||
raise forms.ValidationError('Username contains illegal characters')
|
raise forms.ValidationError('Username contains illegal characters')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user