Browse Source

Re-added support for token-only logins

tags/docs-0.9
RogueException 9 years ago
parent
commit
c1f24d164b
3 changed files with 7 additions and 7 deletions
  1. +3
    -3
      src/Discord.Net/API/Client/Rest/Login.cs
  2. +3
    -3
      src/Discord.Net/DiscordClient.cs
  3. +1
    -1
      src/Discord.Net/Models/Message.cs

+ 3
- 3
src/Discord.Net/API/Client/Rest/Login.cs View File

@@ -5,14 +5,14 @@ namespace Discord.API.Client.Rest
[JsonObject(MemberSerialization.OptIn)]
public sealed class LoginRequest : IRestRequest<LoginResponse>
{
string IRestRequest.Method => "POST";
string IRestRequest.Method => Email != null ? "POST" : "GET";
string IRestRequest.Endpoint => $"auth/login";
object IRestRequest.Payload => this;
bool IRestRequest.IsPrivate => false;

[JsonProperty("email")]
[JsonProperty("email", NullValueHandling = NullValueHandling.Ignore)]
public string Email { get; set; }
[JsonProperty("password")]
[JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)]
public string Password { get; set; }
}



+ 3
- 3
src/Discord.Net/DiscordClient.cs View File

@@ -168,13 +168,13 @@ namespace Discord
await BeginConnect(email, password, null).ConfigureAwait(false);
return ClientAPI.Token;
}
/*/// <summary> Connects to the Discord server with the provided token. </summary>
/// <summary> Connects to the Discord server with the provided token. </summary>
public async Task Connect(string token)
{
if (token == null) throw new ArgumentNullException(token);

await BeginConnect(null, null, token).ConfigureAwait(false);
}*/
}

private async Task BeginConnect(string email, string password, string token = null)
{
@@ -222,7 +222,7 @@ namespace Discord
throw;
}
}
private async Task Login(string email, string password, string token = null)
private async Task Login(string email = null, string password = null, string token = null)
{
string tokenPath = null, oldToken = null;
byte[] cacheKey = null;


+ 1
- 1
src/Discord.Net/Models/Message.cs View File

@@ -208,7 +208,7 @@ namespace Discord
/// <summary> Returns if this message was sent from the logged-in accounts. </summary>
public bool IsAuthor => User != null && User.Id == Client.CurrentUser?.Id;

internal Message(ulong id, Channel channel, User user)
internal Message(ulong id, Channel channel, User user)
{
Id = id;
Channel = channel;


Loading…
Cancel
Save