mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 05:50:16 +02:00
Scrubs usernames on registration allowing only letters, numbers and underscores.
Should prevent issue #46 from appearing on new installs.
This commit is contained in:
parent
d14ec57575
commit
b5a4b4980a
@ -1,5 +1,6 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class RegistrationForm(forms.Form):
|
class RegistrationForm(forms.Form):
|
||||||
@ -20,6 +21,9 @@ class RegistrationForm(forms.Form):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if not re.match("^\w+$", self.cleaned_data['username']):
|
||||||
|
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']:
|
||||||
raise forms.ValidationError(u'Passwords do not match')
|
raise forms.ValidationError(u'Passwords do not match')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user