Accept the historical account manual-link response
All checks were successful
Lobby Account Provisioning Build / lobby-account (push) Successful in 33s
DuneRealms Plugin CI / plugins (push) Successful in 3m4s

This commit is contained in:
unimatrixgit 2026-12-02 11:41:10 +01:00
commit 67d36049c1
2 changed files with 4 additions and 0 deletions

View file

@ -75,6 +75,7 @@ final class LobbyAccountApi implements AutoCloseable {
if (ack ? !"delivered".equals(state) : state == null || !PROVISION_STATES.contains(state)) throw unavailable();
String username = string(data, "username");
String password = string(data, "password");
if ("manual_link_required".equals(state) && "".equals(username)) username = null;
if (username != null && !username.matches("[a-z0-9_]{1,64}")) throw unavailable();
if ("created".equals(state)) {
if (username == null || password == null || !password.matches("[!-~]{20,128}")) throw unavailable();

View file

@ -65,6 +65,9 @@ class LobbyAccountContractTest {
}
assertEquals("delivered", LobbyAccountApi.parse(response(true, "delivered").toString(), request, true).state());
assertThrows(IOException.class, () -> LobbyAccountApi.parse(response(true, "created").toString(), request, true));
JsonObject manual = response(false, "manual_link_required");
manual.addProperty("username", "");
assertNull(LobbyAccountApi.parse(manual.toString(), request, false).username());
}
private JsonObject response(boolean ack, String state) {