mozilla/kuma — pull request #2756 by ubernostrum (2014-09-19 15:18:10+00:00)
Title: Fix bug 986162: Do not allow '@' in new usernames.

This adds the validation to clean_username() on our custom allauth
adapter, ahead of allauth's own default validation (which would allow
the '@'). That validation does two checks:

1. A simple check for the '@' character which, if found, raises a
custom error message explaining that an email address cannot be
used as a username.

2. A tweaked version of allauth's own regex-based check, but with a
regex that does not inclue '@' and displays an error message which
does not suggest '@' as a legal character when the username does
not match.

Testing of this is very light, checking only that clean_username()
does the correct thing and raises errors with the correct
messages. Full integration testing is not currently possible, but
should be added as soon as it becomes possible.