Re-added support for token-only logins

This commit is contained in:
RogueException
2016-01-13 00:15:16 -04:00
parent ac218b3b7c
commit c1f24d164b
3 changed files with 7 additions and 7 deletions

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; }
}

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;

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;