Case insensitive queries for username and email

Queries for usernames and email addresses are done so that case
doesn't matter.  This helps avoid situations where we have two
users with the same username except for case.  It also allows
users to login without matching the exact case they used when they
registered.