summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/auth/management/commands/createsuperuser.py3
-rw-r--r--django/contrib/auth/tests/basic.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py
index 32d845daef..aad6489b38 100644
--- a/django/contrib/auth/management/commands/createsuperuser.py
+++ b/django/contrib/auth/management/commands/createsuperuser.py
@@ -12,7 +12,8 @@ from django.core import exceptions
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
diff --git a/django/contrib/auth/tests/basic.py b/django/contrib/auth/tests/basic.py
index f403613475..ffa11d5d0e 100644
--- a/django/contrib/auth/tests/basic.py
+++ b/django/contrib/auth/tests/basic.py
@@ -66,4 +66,12 @@ Superuser created successfully.
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'!'
"""