mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 14:30:17 +02:00
Change loglevel of validation errors
This commit is contained in:
parent
3b7d361595
commit
bf89c4643c
@ -15,29 +15,29 @@ class RegistrationForm(forms.Form):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if ' ' in self.cleaned_data['username']:
|
if ' ' in self.cleaned_data['username']:
|
||||||
logger.error("RegistrationForm username contains spaces. Raising ValidationError. Username: %s" % self.cleaned_data['username'])
|
logger.debug("RegistrationForm username contains spaces. Raising ValidationError. Username: %s" % self.cleaned_data['username'])
|
||||||
raise forms.ValidationError(u'Username cannot contain a space')
|
raise forms.ValidationError(u'Username cannot contain a space')
|
||||||
|
|
||||||
# We attempt to get the user object if we succeed we know email as been used
|
# We attempt to get the user object if we succeed we know email as been used
|
||||||
try:
|
try:
|
||||||
User.objects.get(email=self.cleaned_data['email'])
|
User.objects.get(email=self.cleaned_data['email'])
|
||||||
logger.error("RegistrationForm email already registered. Raising ValidationError")
|
logger.debug("RegistrationForm email already registered. Raising ValidationError")
|
||||||
raise forms.ValidationError(u'Email as already been used')
|
raise forms.ValidationError(u'Email as already been used')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not re.match("^\w+$", self.cleaned_data['username']):
|
if not re.match("^\w+$", self.cleaned_data['username']):
|
||||||
logger.error("RegistrationForm username contains non-alphanumeric characters. Raising ValueError. Username: %s" % self.cleaned_data['username'])
|
logger.debug("RegistrationForm username contains non-alphanumeric characters. Raising ValueError. Username: %s" % self.cleaned_data['username'])
|
||||||
raise forms.ValidationError(u'Username contains illegal characters')
|
raise forms.ValidationError(u'Username contains illegal characters')
|
||||||
|
|
||||||
if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data:
|
if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data:
|
||||||
if self.cleaned_data['password'] != self.cleaned_data['password_again']:
|
if self.cleaned_data['password'] != self.cleaned_data['password_again']:
|
||||||
logger.error("RegistrationForm password mismatch. Raising ValueError")
|
logger.debug("RegistrationForm password mismatch. Raising ValueError")
|
||||||
raise forms.ValidationError(u'Passwords do not match')
|
raise forms.ValidationError(u'Passwords do not match')
|
||||||
|
|
||||||
if 'email' in self.cleaned_data and 'email_again' in self.cleaned_data:
|
if 'email' in self.cleaned_data and 'email_again' in self.cleaned_data:
|
||||||
if self.cleaned_data['email'] != self.cleaned_data['email_again']:
|
if self.cleaned_data['email'] != self.cleaned_data['email_again']:
|
||||||
logger.error("RegistrationForm email mismatch. Raising ValidationError")
|
logger.debug("RegistrationForm email mismatch. Raising ValidationError")
|
||||||
raise forms.ValidationError(u'Emails do not match')
|
raise forms.ValidationError(u'Emails do not match')
|
||||||
|
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user