abstracted out isValidEmail() method out of the login-register modal