Slightly bigger fix
This commit is contained in:
parent
aa4a3f02be
commit
919e57a2a9
1 changed files with 6 additions and 6 deletions
|
@ -34,7 +34,7 @@ public class LoginPage extends Page {
|
||||||
UUID state = UUID.fromString(q.get("state"));
|
UUID state = UUID.fromString(q.get("state"));
|
||||||
if (!states.containsKey(state))
|
if (!states.containsKey(state))
|
||||||
return nope;
|
return nope;
|
||||||
String[] folder_id = states.get(state).split("-");
|
String[] folder_id = states.get(state).split(" ");
|
||||||
if (!folder_id[0].equalsIgnoreCase(type)) //TODO: Use for other OAuth stuff as well
|
if (!folder_id[0].equalsIgnoreCase(type)) //TODO: Use for other OAuth stuff as well
|
||||||
return nope;
|
return nope;
|
||||||
TBMCPlayer cp = TBMCPlayer.getPlayer(UUID.fromString(folder_id[1]), TBMCPlayer.class);
|
TBMCPlayer cp = TBMCPlayer.getPlayer(UUID.fromString(folder_id[1]), TBMCPlayer.class);
|
||||||
|
@ -48,13 +48,13 @@ public class LoginPage extends Page {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
} else return new Response(418, "Now what", exchange); //Minecraft doesn't have full OAuth
|
||||||
}
|
}
|
||||||
return new Response(200, "", exchange);
|
return new Response(400, "Wut", exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value: Folder-ID
|
* Value: Folder ID (don't use dashes as a separator... UUIDs contain them)
|
||||||
*/
|
*/
|
||||||
private static final HashBiMap<UUID, String> states = HashBiMap.create();
|
private static final HashBiMap<UUID, String> states = HashBiMap.create();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class LoginPage extends Page {
|
||||||
*/
|
*/
|
||||||
public static UUID generateState(String type, String id) {
|
public static UUID generateState(String type, String id) {
|
||||||
UUID state = UUID.randomUUID();
|
UUID state = UUID.randomUUID();
|
||||||
states.forcePut(state, type + "-" + id); //Replace existing for an user
|
states.forcePut(state, type + " " + id); //Replace existing for an user
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue