Shouldn't it just insert in all lowercase the first time and lowercase the login email supplied by the user when comparing?