Since the Register API call now requires the client's access token in order to validate his Minecraft login, it is now being provided.
This commit is contained in:
@@ -36,11 +36,14 @@ public class ApiClient {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public AuthKey register(String username, String mail, String password) throws IOException, ApiException {
|
||||
public AuthKey register(String username, String mail, String password, String uuid, String accessToken)
|
||||
throws IOException, ApiException {
|
||||
QueryBuilder builder = new QueryBuilder(ReplayModApiMethods.register);
|
||||
builder.put("username", username);
|
||||
builder.put("email", mail);
|
||||
builder.put("password", password);
|
||||
builder.put("uuid", uuid);
|
||||
builder.put("accesstoken", accessToken);
|
||||
AuthKey auth = invokeAndReturn(builder, AuthKey.class);
|
||||
return auth;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ public class GuiRegister extends GuiScreen {
|
||||
} catch(ApiException ae) {
|
||||
message = ae.getLocalizedMessage();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
message = I18n.format("replaymod.gui.login.connectionerror");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import eu.crushedpixel.replaymod.api.ApiClient;
|
||||
import eu.crushedpixel.replaymod.api.ApiException;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.AuthConfirmation;
|
||||
import eu.crushedpixel.replaymod.api.replay.holders.AuthKey;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -33,8 +34,12 @@ public class AuthenticationHandler {
|
||||
return apiClient.hasDonated(uuid);
|
||||
}
|
||||
|
||||
private static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public static void register(String usrname, String mail, String password) throws IOException, ApiException {
|
||||
AuthKey auth = apiClient.register(usrname, mail, password);
|
||||
AuthKey auth = apiClient.register(usrname, mail, password,
|
||||
mc.getSession().getProfile().getId().toString(),
|
||||
Minecraft.getMinecraft().getSession().getToken());
|
||||
username = usrname;
|
||||
authkey = auth.getAuthkey();
|
||||
saveAuthkey(authkey);
|
||||
|
||||
@@ -23,7 +23,8 @@ replaymod.api.usernameexists=This username is already taken
|
||||
replaymod.api.mailexists=This Email address is already linked to an account
|
||||
replaymod.api.invalidmail=Invalid Email Address
|
||||
replaymod.api.nopermissions=You don't have permission to do this
|
||||
|
||||
replaymod.api.authfailed=Authentication to the Minecraft Session Servers failed
|
||||
replaymod.api.mcuserexists=A ReplayMod account is already associated with this Minecraft account
|
||||
|
||||
#All of the chat messages
|
||||
replaymod.chat.recordingstarted=Recording started
|
||||
|
||||
Reference in New Issue
Block a user