Disallow creation of user accounts with @ and _
authorMagnus Hagander <magnus@hagander.net>
Fri, 14 Apr 2017 15:17:32 +0000 (17:17 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 14 Apr 2017 15:17:32 +0000 (17:17 +0200)
Mediawiki is just too limiting in which characters it supports, and
having to rename users once they eventually want to do things with the
wiki is getting out of hand. So we limit the global system to the
silliest common denominator, which at this point appears to be
mediawiki.

pgweb/account/forms.py

index 117ee59916697f25267b8e5a72dba5a98e2e401d..75297b107824701716524d7093627ba42786dd1f 100644 (file)
@@ -55,8 +55,8 @@ class SignupForm(forms.Form):
        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.")
+               if not re.match('^[a-z0-9\.-]+$', username):
+                       raise forms.ValidationError("Invalid character in user name. Only a-z, 0-9, . and - allowed for compatibility with third party software.")
                try:
                        User.objects.get(username=username)
                except User.DoesNotExist: