mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Use POST instead of GET for Minecraft login
This commit is contained in:
parent
b42a400582
commit
4ad816d3ef
2 changed files with 4 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
#region Login to Minecraft.net, Obtaining a session ID
|
#region Login to Minecraft.net, Obtaining a session ID
|
||||||
|
|
||||||
public enum LoginResult { Error, Success, WrongPassword, Blocked, AccountMigrated, NotPremium };
|
public enum LoginResult { Error, Success, WrongPassword, Blocked, AccountMigrated, NotPremium, BadRequest };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows to login to a premium Minecraft account, and retrieve the session ID.
|
/// Allows to login to a premium Minecraft account, and retrieve the session ID.
|
||||||
|
|
@ -32,11 +32,12 @@ namespace MinecraftClient
|
||||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||||
WebClient wClient = new WebClient();
|
WebClient wClient = new WebClient();
|
||||||
Console.WriteLine("https://login.minecraft.net/?user=" + user + "&password=<******>&version=13");
|
Console.WriteLine("https://login.minecraft.net/?user=" + user + "&password=<******>&version=13");
|
||||||
string result = wClient.DownloadString("https://login.minecraft.net/?user=" + user + "&password=" + pass + "&version=13");
|
string result = Encoding.ASCII.GetString(wClient.UploadValues("https://login.minecraft.net/", new System.Collections.Specialized.NameValueCollection() { { "user", user }, { "password", pass }, { "version", "13" } } ));
|
||||||
outdata = result;
|
outdata = result;
|
||||||
Console.WriteLine(result);
|
Console.WriteLine(result);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
if (result == "Bad login") { return LoginResult.WrongPassword; }
|
if (result == "Bad login") { return LoginResult.WrongPassword; }
|
||||||
|
if (result == "Bad request") { return LoginResult.BadRequest; }
|
||||||
if (result == "User not premium") { return LoginResult.NotPremium; }
|
if (result == "User not premium") { return LoginResult.NotPremium; }
|
||||||
if (result == "Too many failed logins") { return LoginResult.Blocked; }
|
if (result == "Too many failed logins") { return LoginResult.Blocked; }
|
||||||
if (result == "Account migrated, use e-mail as username.") { return LoginResult.AccountMigrated; }
|
if (result == "Account migrated, use e-mail as username.") { return LoginResult.AccountMigrated; }
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
case MinecraftCom.LoginResult.AccountMigrated: Console.WriteLine("Account migrated, use e-mail as username."); break;
|
case MinecraftCom.LoginResult.AccountMigrated: Console.WriteLine("Account migrated, use e-mail as username."); break;
|
||||||
case MinecraftCom.LoginResult.Blocked: Console.WriteLine("Too many failed logins. Please try again later."); break;
|
case MinecraftCom.LoginResult.Blocked: Console.WriteLine("Too many failed logins. Please try again later."); break;
|
||||||
|
case MinecraftCom.LoginResult.BadRequest: Console.WriteLine("Login attempt rejected: Bad request."); break;
|
||||||
case MinecraftCom.LoginResult.WrongPassword: Console.WriteLine("Incorrect password."); break;
|
case MinecraftCom.LoginResult.WrongPassword: Console.WriteLine("Incorrect password."); break;
|
||||||
case MinecraftCom.LoginResult.NotPremium: Console.WriteLine("User not premium."); break;
|
case MinecraftCom.LoginResult.NotPremium: Console.WriteLine("User not premium."); break;
|
||||||
case MinecraftCom.LoginResult.Error: Console.WriteLine("Network error."); break;
|
case MinecraftCom.LoginResult.Error: Console.WriteLine("Network error."); break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue