Index: django/conf/global_settings.py
===================================================================
--- django/conf/global_settings.py	(revision 6783)
+++ django/conf/global_settings.py	(working copy)
@@ -335,6 +335,7 @@
 
 LOGIN_REDIRECT_URL = '/accounts/profile/'
 
+AUTH_USERNAME_PATTERN = '^\w+$'
 ###########
 # TESTING #
 ###########
Index: django/contrib/auth/forms.py
===================================================================
--- django/contrib/auth/forms.py	(revision 6783)
+++ django/contrib/auth/forms.py	(working copy)
@@ -6,22 +6,28 @@
 from django import oldforms
 from django.utils.translation import ugettext as _
 
+import re
+from django.conf import settings
+
 class UserCreationForm(oldforms.Manipulator):
     "A form that creates a user, with no privileges, from the given username and password."
     def __init__(self):
         self.fields = (
             oldforms.TextField(field_name='username', length=30, max_length=30, is_required=True,
-                validator_list=[validators.isAlphaNumeric, self.isValidUsername]),
+                validator_list=[self.isValidUsername]),
             oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True),
             oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True,
                 validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
         )
 
     def isValidUsername(self, field_data, all_data):
+        if not re.search(getattr(settings, 'AUTH_USERNAME_PATTERN'), field_data, re.U):
+            raise validators.ValidationError, _('Username contains illegal characters.')
+
         try:
             User.objects.get(username=field_data)
         except User.DoesNotExist:
-            return
+            return     
         raise validators.ValidationError, _('A user with that username already exists.')
 
     def save(self, new_data):
Index: django/contrib/auth/tests.py
===================================================================
--- django/contrib/auth/tests.py	(revision 6783)
+++ django/contrib/auth/tests.py	(working copy)
@@ -23,4 +23,12 @@
 []
 >>> a.user_permissions.all()
 []
-"""
\ No newline at end of file
+>>> from django.contrib.auth.forms import *
+>>> cf = UserCreationForm()
+>>> cf.isValidUsername("aa", '')
+>>> cf.isValidUsername("b!", '')
+Traceback (most recent call last):
+...
+ValidationError: [u'Username contains illegal characters.']
+    
+"""
Index: docs/tutorial02.txt
===================================================================
--- docs/tutorial02.txt	(revision 6783)
+++ docs/tutorial02.txt	(working copy)
@@ -359,6 +359,13 @@
 filters, date-hierarchies and column-header-ordering all work together like you
 think they should.
 
+Customize the username pattern
+======================================
+
+Open your settings file (``mysite/settings.py``, remember) and look at the
+``AUTH_USERNAME_PATTERN`` setting. The default value is ''^\w+$'', which you
+may change it to any pattern in UTF-8, for example, '^ab.*$'.
+
 Customize the admin look and feel
 =================================
 
