realm support updated

Ton of logic in this. Support for email users, normal users, and normal
users that have a '.' in their name.