Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #3165 -- Really allow underscores when making a superuser, than…

…ks `SmileyChris`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 298d76aed44894ad4a40e8745ec7bf88430be635 1 parent 38fe6bf
Gary Wilson Jr. authored January 13, 2008

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  django/contrib/auth/create_superuser.py
5  django/contrib/auth/create_superuser.py
@@ -10,6 +10,9 @@
10 10
 import getpass
11 11
 import os
12 12
 import sys
  13
+import re
  14
+
  15
+RE_VALID_USERNAME = re.compile('\w+$')
13 16
 
14 17
 def createsuperuser(username=None, email=None, password=None):
15 18
     """
@@ -43,7 +46,7 @@ def createsuperuser(username=None, email=None, password=None):
43 46
                 username = raw_input(input_msg + ': ')
44 47
             if default_username and username == '':
45 48
                 username = default_username
46  
-            if not username.isalnum():
  49
+            if not RE_VALID_USERNAME.match(username):
47 50
                 sys.stderr.write("Error: That username is invalid. Use only letters, digits and underscores.\n")
48 51
                 username = None
49 52
                 continue

0 notes on commit 298d76a

Please sign in to comment.
Something went wrong with that request. Please try again.