Browse Source

Update API token after changing password

tags/docs-0.9
RogueException 9 years ago
parent
commit
72e43227bf
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/Discord.Net/DiscordClient.Users.cs

+ 8
- 2
src/Discord.Net/DiscordClient.Users.cs View File

@@ -281,16 +281,22 @@ namespace Discord
_dataSocket.SendGetUsers(server.Id);
}

public Task EditProfile(string currentPassword = "",
public async Task EditProfile(string currentPassword = "",
string username = null, string email = null, string password = null,
Stream avatar = null, ImageType avatarType = ImageType.Png)
{
if (currentPassword == null) throw new ArgumentNullException(nameof(currentPassword));
CheckReady();

return _api.EditProfile(currentPassword: currentPassword,
await _api.EditProfile(currentPassword: currentPassword,
username: username ?? _privateUser?.Name, email: email ?? _privateUser?.Global.Email, password: password,
avatar: avatar, avatarType: avatarType);

if (password != null)
{
var loginResponse = await _api.Login(_privateUser.Global.Email, password);
_api.Token = loginResponse.Token;
}
}

public Task SetStatus(UserStatus status)


Loading…
Cancel
Save