Allow users to login with their email address

This supersedes #29.

Things left to do:

- [X] Allow the username field to accept email addresses too.
- [x] Update the login form so that the field reads "username or email address"
- [x] Add tests.