Prevent problematic usernames

Related but not limited to this thread:

Some of my users have entered email addresses as their usernames. It seems to log them in upon intialization, but the next time they try to log in, it gives a password error. This is (presumably) due to the non-alphanumeric characters in the username being problematic.

Usernames should be limited to alphanumeric, or, made to handle other characters as well.