Ticket #6588: allow_dots_in_usernames-1.patch
File allow_dots_in_usernames-1.patch, 2.8 KB (added by , 16 years ago) |
---|
-
django/core/validators.py
23 23 _datere = r'\d{4}-\d{1,2}-\d{1,2}' 24 24 _timere = r'(?:[01]?[0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?' 25 25 alnum_re = re.compile(r'^\w+$') 26 alnumdot_re = re.compile(r'^[\.\w]+$') 26 27 alnumurl_re = re.compile(r'^[-\w/]+$') 27 28 ansi_date_re = re.compile('^%s$' % _datere) 28 29 ansi_time_re = re.compile('^%s$' % _timere) … … 67 68 def __str__(self): 68 69 return str(self.messages) 69 70 71 def isAlphaDotNumeric(field_data, all_data): 72 if not alnumdot_re.search(field_data): 73 raise ValidationError, "This value must contain only letters, dots, digits and underscores." 74 70 75 def isAlphaNumeric(field_data, all_data): 71 76 if not alnum_re.search(field_data): 72 77 raise ValidationError, _("This value must contain only letters, numbers and underscores.") -
django/contrib/auth/models.py
128 128 129 129 Username and password are required. Other fields are optional. 130 130 """ 131 username = models.CharField(_('username'), max_length=30, unique=True, validator_list=[validators.isAlpha Numeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))131 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).")) 132 132 first_name = models.CharField(_('first name'), max_length=30, blank=True) 133 133 last_name = models.CharField(_('last name'), max_length=30, blank=True) 134 134 email = models.EmailField(_('e-mail address'), blank=True) -
django/contrib/auth/forms.py
11 11 def __init__(self): 12 12 self.fields = ( 13 13 oldforms.TextField(field_name='username', length=30, max_length=30, is_required=True, 14 validator_list=[validators.isAlpha Numeric, self.isValidUsername]),14 validator_list=[validators.isAlphaDotNumeric, self.isValidUsername]), 15 15 oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True), 16 16 oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True, 17 17 validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),