Added GuiRegister to allow users to create a new account on ReplayMod.com from the Mod itself

This commit is contained in:
CrushedPixel
2015-05-03 21:58:24 +02:00
parent 38ca7a0054
commit 5a3e3575c3
11 changed files with 327 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.online.authentication;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.api.client.ApiClient;
import eu.crushedpixel.replaymod.api.client.ApiException;
import eu.crushedpixel.replaymod.api.client.holders.AuthKey;
import java.io.IOException;
@@ -28,6 +29,12 @@ public class AuthenticationHandler {
return apiClient.hasDonated(uuid);
}
public static void register(String username, String mail, String password) throws IOException, ApiException {
AuthKey auth = apiClient.register(username, mail, password);
authkey = auth.getAuthkey();
}
public static int authenticate(String username, String password) {
try {
authkey = ReplayMod.apiClient.getLogin(username, password).getAuthkey();