[WIP] 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.
- [ ] Update the login form so that the field reads "username or email address"
- [ ] Add tests.