aboutsummaryrefslogtreecommitdiff
path: root/loader/src
diff options
context:
space:
mode:
Diffstat (limited to 'loader/src')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java2
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java4
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java18
3 files changed, 18 insertions, 6 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java
index c6834a47..27a0b6dc 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java
@@ -112,7 +112,7 @@ public class AuthManager {
}
- AuthToken acceptPrivacyPolicy() {
+ public AuthToken acceptPrivacyPolicy() {
if (reauthLock) {
while(reauthLock);
return currentToken;
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
index 68a31ccd..be247c88 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/DgAuthUtil.java
@@ -59,7 +59,7 @@ public class DgAuthUtil {
json.isNull("qrCode") ? null: json.getString("qrCode")
);
- if (!"SUCCESS".equals(response.getStatus())) {
+ if (!"Success".equals(response.getStatus())) {
throw new AuthServerException(response);
}
@@ -129,7 +129,7 @@ public class DgAuthUtil {
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
- urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"sharedSecret\":\""+Base64.encodeBase64URLSafeString(encSecret)+"\"}").getBytes());
+ urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"sharedSecret\":\""+Base64.encodeBase64String(encSecret)+"\"}").getBytes());
JSONObject data = getResponse(urlConnection, JSONObject.class);
try {
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java
index f7acb18a..72d08cea 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiPrivacyPolicy.java
@@ -1,5 +1,8 @@
package kr.syeyoung.dungeonsguide.launcher.gui.screen;
+import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.auth.AuthFailedExeption;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.auth.PrivacyPolicyRequiredException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import org.lwjgl.opengl.GL11;
@@ -10,8 +13,11 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen {
@Override
public void initGui() {
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
- this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2+50,sr.getScaledHeight()-40, 300, 20,"Accept Privacy Policy"));
- this.buttonList.add(new GuiButton(1, sr.getScaledWidth()/2-50-300,sr.getScaledHeight()-40, 300, 20,"Deny and Play Without DG"));
+
+ int width = Math.min(300, sr.getScaledWidth() / 2 - 20);
+
+ this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2 + 10,sr.getScaledHeight()-40, width, 20,"Accept Privacy Policy"));
+ this.buttonList.add(new GuiButton(1, sr.getScaledWidth() / 2 - 10 - width,sr.getScaledHeight()-40, width, 20,"Deny and Play Without DG"));
}
@@ -20,6 +26,12 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen {
super.actionPerformed(button);
if (button.id == 0) {
// accept
+ try {
+ AuthManager.getInstance().acceptPrivacyPolicy();
+ } catch (PrivacyPolicyRequiredException e) {
+// GuiDisplayer.INSTANCE.displayGui(new GuiLoadingError(e));
+ // display tooltip.
+ }
dismiss();
} else if (button.id == 1) {
dismiss();
@@ -35,7 +47,7 @@ public class GuiPrivacyPolicy extends SpecialGuiScreen {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
fontRenderer.drawString("Please accept or deny Dungeons Guide Privacy Policy to continue", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please accept or deny Dungeons Guide Privacy Policy to continue"))/2,40,0xFFFF0000);
-
+ fontRenderer.drawString("Blah blah legal stuff", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please accept or deny Dungeons Guide Privacy Policy to continue"))/2,sr.getScaledHeight() / 2, 0xFFFFFFFF);
super.drawScreen(mouseX, mouseY, partialTicks);
}