8000 Fixed #13569 -- Fixed createsuperuser management command to work with… · ddriddle/django@286ce85 · GitHub
[go: up one dir, main page]

Skip to content

Commit 286ce85

Browse files
committed
Fixed django#13569 -- Fixed createsuperuser management command to work with the new relaxed requirements for usernames.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent b057a8b commit 286ce85

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

django/contrib/auth/management/commands/createsuperuser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from django.core.management.base import BaseCommand, CommandError
1313
from django.utils.translation import ugettext as _
1414

15-
RE_VALID_USERNAME = re.compile('\w+$')
15+
RE_VALID_USERNAME = re.compile('[\w.@+-]+$')
16+
1617
EMAIL_RE = re.compile(
1718
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
1819
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' # quoted-string

django/contrib/auth/tests/basic.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,12 @@
6666
u'joe@somewhere.org'
6767
>>> u.password
6868
u'!'
69+
>>> call_command("createsuperuser", interactive=False, username="joe+admin@somewhere.org", email="joe@somewhere.org")
70+
Superuser created successfully.
71+
72+
>>> u = User.objects.get(username="joe+admin@somewhere.org")
73+
>>> u.email
74+
u'joe@somewhere.org'
75+
>>> u.password
76+
u'!'
6977
"""

0 commit comments

Comments
 (0)
0