1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #5786: relaxed the validation for usernames to allow more common characters '@', etc.

This is really just a stop-gap until we come up with a improved way of handling
disparate auth data, but it should help us stretch a bit more milage out of the
current system.

Thanks to alextreme, lbruno, and clayg.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12634 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2010-03-01 19:49:05 +00:00
parent 647651698f
commit c8015052d9
5 changed files with 22 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ False
# The username contains invalid data.
>>> data = {
... 'username': 'jsmith@example.com',
... 'username': 'jsmith!',
... 'password1': 'test123',
... 'password2': 'test123',
... }
@@ -29,7 +29,7 @@ False
>>> form.is_valid()
False
>>> form["username"].errors
[u'This value must contain only letters, numbers and underscores.']
[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
# The verification password is incorrect.
@@ -65,7 +65,7 @@ False
# The success case.
>>> data = {
... 'username': 'jsmith2',
... 'username': 'jsmith2@example.com',
... 'password1': 'test123',
... 'password2': 'test123',
... }
@@ -73,7 +73,7 @@ False
>>> form.is_valid()
True
>>> form.save()
<User: jsmith2>
<User: jsmith2@example.com>
# The user submits an invalid username.
@@ -189,7 +189,7 @@ True
>>> form.is_valid()
False
>>> form['username'].errors
[u'This value must contain only letters, numbers and underscores.']
[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
### PasswordResetForm