Index: django/core/validators.py =================================================================== --- django/core/validators.py (revision 7104) +++ django/core/validators.py (working copy) @@ -23,6 +23,7 @@ _datere = r'\d{4}-\d{1,2}-\d{1,2}' _timere = r'(?:[01]?[0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?' alnum_re = re.compile(r'^\w+$') +alnumdot_re = re.compile(r'^[\.\w]+$') alnumurl_re = re.compile(r'^[-\w/]+$') ansi_date_re = re.compile('^%s$' % _datere) ansi_time_re = re.compile('^%s$' % _timere) @@ -67,6 +68,10 @@ def __str__(self): return str(self.messages) +def isAlphaDotNumeric(field_data, all_data): + if not alnumdot_re.search(field_data): + raise ValidationError, "This value must contain only letters, dots, digits and underscores." + def isAlphaNumeric(field_data, all_data): if not alnum_re.search(field_data): raise ValidationError, _("This value must contain only letters, numbers and underscores.") Index: django/contrib/auth/models.py =================================================================== --- django/contrib/auth/models.py (revision 7104) +++ django/contrib/auth/models.py (working copy) @@ -128,7 +128,7 @@ Username and password are required. Other fields are optional. """ - username = models.CharField(_('username'), max_length=30, unique=True, validator_list=[validators.isAlphaNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores).")) + username = models.CharField(_('username'), max_length=30, unique=True, validator_list=[validators.isAlphaDotNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, dots, digits and underscores).")) first_name = models.CharField(_('first name'), max_length=30, blank=True) last_name = models.CharField(_('last name'), max_length=30, blank=True) email = models.EmailField(_('e-mail address'), blank=True) Index: django/contrib/auth/forms.py =================================================================== --- django/contrib/auth/forms.py (revision 7104) +++ django/contrib/auth/forms.py (working copy) @@ -11,7 +11,7 @@ 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=[validators.isAlphaDotNumeric, 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."))]),