return result from login and register in the returned promise