Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #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
  • Loading branch information...
commit 286ce85e45a7356d96f27ee83a4587e5f44c87a9 1 parent b057a8b
@jezdez jezdez authored
View
3  django/contrib/auth/management/commands/createsuperuser.py
@@ -12,7 +12,8 @@
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
-RE_VALID_USERNAME = re.compile('\w+$')
+RE_VALID_USERNAME = re.compile('[\w.@+-]+$')
+
EMAIL_RE = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' # quoted-string
View
8 django/contrib/auth/tests/basic.py
@@ -66,4 +66,12 @@
u'joe@somewhere.org'
>>> u.password
u'!'
+>>> call_command("createsuperuser", interactive=False, username="joe+admin@somewhere.org", email="joe@somewhere.org")
+Superuser created successfully.
+
+>>> u = User.objects.get(username="joe+admin@somewhere.org")
+>>> u.email
+u'joe@somewhere.org'
+>>> u.password
+u'!'
"""
Please sign in to comment.
Something went wrong with that request. Please try again.