Add support for logging in with email

As it is right now the part after @ will simply be ignored and a
username matching e.g. d12andpe% will be looked up in the database.
Since students are divided into years (the first 3 characters) and each
username is unique this shouldn't cause any problems.