Пример #1
0
 public async Task UpdatePasswordAsync(string password)
 {
     try
     {
         await _user.UpdatePasswordAsync(password).ConfigureAwait(false);
     }
     catch (FirebaseException e)
     {
         throw ExceptionMapper.Map(e);
     }
 }
Пример #2
0
    /// <summary>
    /// Changes the user password
    /// </summary>
    /// <returns><c>true</c>, if password was changed, <c>false</c> otherwise</returns>
    /// <param name="newPassword">New plain text password</param>
    public static void FirebaseChangePassword(string newPassword, FirebaseUser requestedUser = null)
    {
        if (requestedUser == null)
        {
            requestedUser = activeUser;
        }

        // Encrypt the password so we're not just storing it in plain text
        string encryptedNewPassword = sha512EncryptString(newPassword);

        ProjectManager.Log("[Firebase Password Change] " + encryptedNewPassword);

        if (requestedUser != null)
        {
            requestedUser.UpdatePasswordAsync(encryptedNewPassword).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    Analytics.LogError("Firebase Password Change", "Change password was canceled!");
                    return;
                }

                if (task.IsFaulted)
                {
                    // Firebase for Unity is pretty undocumented for doing more than simply adding the plugins into projects..
                    // Error handling doesn't seem great either, as of building this there's no error enum or error codes
                    // So we just have strings to work with if we want to do actions on specific errors happening
                    foreach (Exception e in task.Exception.InnerExceptions)
                    {
                        Analytics.LogError("Firebase Password Change", e.Message);                                 // This string only includes the firebase error, no information about the exception type

                        OnPasswordChangeFailed(ConvertToAuthError(e.Message));
                    }
                    return;
                }

                if (task.IsCompleted)
                {
                    // Firebase user password changed successfully
                    OnPasswordChangeSuccessful();
                }
            });
        }
        else
        {
            Analytics.LogError("Firebase Password Change", "User was null!");
        }
    }
 public Task UpdatePasswordAsync(string password)
 {
     return(_wrapped.UpdatePasswordAsync(password));
 }
Пример #4
0
 public void changePassword(string newPassword)
 {
     user.UpdatePasswordAsync(newPassword);
 }