Accept the historical account manual-link response
This commit is contained in:
parent
840af6cb00
commit
67d36049c1
2 changed files with 4 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff