Exemple #1
0
        public async Task <bool> CreateUserWithEmailPassword(string email, string password)
        {
            try
            {
                string token = await _auth.CreateUserWithEmailPassword(email, password);

                if (!string.IsNullOrEmpty(token))
                {
                    await StorageVault.SetCredentials(email, password);

                    await StorageVault.SetToken(token);

                    await UserProfileService.Instance.LoadUserProfile(email);

                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public async Task <bool> LoginWithEmailPassword(string email, string password)
        {
            try
            {
                string token = await _auth.LoginWithEmailPassword(email, password);

                if (!string.IsNullOrEmpty(token))
                {
                    try
                    {
                        await StorageVault.SetCredentials(email, password);

                        await StorageVault.SetToken(token);

                        await UserProfileService.Instance.LoadUserProfile(email);
                    }
                    catch (Exception)
                    {
                        Debug.WriteLine("Either can't save credentials or load profile");
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (InvalidLoginException)
            {
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }