Specifically, only allow alphabetical, numbers, _@- and period.
The website it self handles "advanced" characters just fine, but all
systems integrated through community authentication does not.
from django import forms
+import re
+
from django.contrib.auth.models import User
from pgweb.core.models import UserProfile
def clean_username(self):
username = self.cleaned_data['username'].lower()
+ if not re.match('^[a-z0-9_@\.-]+$', username):
+ raise forms.ValidationError("Invalid character in user name. Only a-z, 0-9, _, @, . and - allowed.")
try:
u = User.objects.get(username=username)
except User.DoesNotExist: