/// <summary> /// Changes the user's password. /// </summary> /// <param name="newPassword">The user's new password.</param> /// <remarks> /// Changing a user's password using an authentication server that doesn't /// use HTTPS is a major security flaw, and should only be done while testing. /// </remarks> /// <returns>An awaitable task that, when successful, indicates that the password has changed.</returns> public Task ChangePasswordAsync(string newPassword) { Argument.Ensure <InvalidOperationException>(State == UserState.Active, "Password may be changed only by active users."); Argument.NotNullOrEmpty(newPassword, nameof(newPassword)); return(AuthenticationHelper.ChangePasswordAsync(this, newPassword)); }
/// <summary> /// Changes the user's password. /// </summary> /// <param name="newPassword">The user's new password.</param> /// <remarks> /// Changing a user's password using an authentication server that doesn't /// use HTTPS is a major security flaw, and should only be done while testing. /// </remarks> /// <returns>An awaitable task that, when successful, indicates that the password has changed.</returns> public Task ChangePasswordAsync(string newPassword) { if (State != UserState.Active) { throw new InvalidOperationException("Password may be changed only by active users."); } if (string.IsNullOrEmpty(newPassword)) { throw new ArgumentNullException(nameof(newPassword)); } return(AuthenticationHelper.ChangePasswordAsync(this, newPassword)); }