Commit c1000682 authored by ivarnm's avatar ivarnm
Browse files

Trim user input

parent 2ebe5c47
......@@ -203,7 +203,7 @@ public final class QueryIntermediate {
Map<String, String> params = new HashMap<>();
params.put("playerId", tournament.getPlayers().get(0));
params.put("games", tournament.getGames().toString());
params.put("name", tournament.getName());
params.put("name", tournament.getName().trim());
params.put("timePerRound", Double.toString(tournament.getTimePerRound()));
params.put("maxPlayers", Integer.toString(tournament.getMaxPlayers()));
params.put("roundsPerGame", Integer.toString(tournament.getRoundsPerGame()));
......@@ -331,6 +331,8 @@ public final class QueryIntermediate {
}
public static Player loginPlayer(String username, String password) throws IOException, NoSuchElementException {
username = username.trim();
password = password.trim();
String route = "players/login/" + username + "/" + password;
String[] response = sendGetRequest(route);
checkStatusCode(response);
......@@ -341,6 +343,8 @@ public final class QueryIntermediate {
public static Player createNewPlayer(String username, String password) throws IOException, NoSuchElementException {
String route = "players/";
username = username.trim();
password = password.trim();
Map<String, String> params = new HashMap<>();
params.put("username", username);
params.put("password", password);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment