Fix case mismatch error in domain invitations

Addresses this ticket: http://manage.dimagi.com/default.asp?114017#687642

If the email address in a domain invitation has different capitalization than the user's email address in the database, then that user sees an error message when he or she accepts the invitation (but he or she is still added to the domain). This change lower cases both addresses before comparing them for equality.

@dimagi/team-commcare-hq 
According to this [SO answer](http://stackoverflow.com/a/9808332), it is up to each email host to decide if they want the part of the email address before the '@' to be case sensitive or not. Although apparently no widely used email providers treat it as case sensitive. So, there is a small security risk here. (It also looks like CommcareHQ login ignores case).
The logic in this whole block is a little hard to follow, if we end up doing any more work on this it might be worth refactoring to be clear what's actually happening.  It's not clear to me that is_invited_user is actually a necessary check and how that fits in with is_invited.