Updated code to change login/registration mechanism to use email address instead of loginId.