diff options
| author | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-01-13 04:03:36 +0000 |
|---|---|---|
| committer | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-01-13 04:03:36 +0000 |
| commit | 298d76aed44894ad4a40e8745ec7bf88430be635 (patch) | |
| tree | a23c427f8054d7ea3575427aff231a9512499f14 | |
| parent | 38fe6bf0faa535956dcfc0bfe244a324ab6b1ee3 (diff) | |
Fixed #3165 -- Really allow underscores when making a superuser, thanks `SmileyChris`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/auth/create_superuser.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/contrib/auth/create_superuser.py b/django/contrib/auth/create_superuser.py index 2e93c35b93..7b6cefd268 100644 --- a/django/contrib/auth/create_superuser.py +++ b/django/contrib/auth/create_superuser.py @@ -10,6 +10,9 @@ from django.contrib.auth.models import User import getpass import os import sys +import re + +RE_VALID_USERNAME = re.compile('\w+$') def createsuperuser(username=None, email=None, password=None): """ @@ -43,7 +46,7 @@ def createsuperuser(username=None, email=None, password=None): username = raw_input(input_msg + ': ') if default_username and username == '': username = default_username - if not username.isalnum(): + if not RE_VALID_USERNAME.match(username): sys.stderr.write("Error: That username is invalid. Use only letters, digits and underscores.\n") username = None continue |
