Skip to content
Snippets Groups Projects
Commit c1000682 authored by ivarnm's avatar ivarnm
Browse files

Trim user input

parent 2ebe5c47
No related branches found
No related tags found
No related merge requests found
...@@ -203,7 +203,7 @@ public final class QueryIntermediate { ...@@ -203,7 +203,7 @@ public final class QueryIntermediate {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("playerId", tournament.getPlayers().get(0)); params.put("playerId", tournament.getPlayers().get(0));
params.put("games", tournament.getGames().toString()); 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("timePerRound", Double.toString(tournament.getTimePerRound()));
params.put("maxPlayers", Integer.toString(tournament.getMaxPlayers())); params.put("maxPlayers", Integer.toString(tournament.getMaxPlayers()));
params.put("roundsPerGame", Integer.toString(tournament.getRoundsPerGame())); params.put("roundsPerGame", Integer.toString(tournament.getRoundsPerGame()));
...@@ -331,6 +331,8 @@ public final class QueryIntermediate { ...@@ -331,6 +331,8 @@ public final class QueryIntermediate {
} }
public static Player loginPlayer(String username, String password) throws IOException, NoSuchElementException { public static Player loginPlayer(String username, String password) throws IOException, NoSuchElementException {
username = username.trim();
password = password.trim();
String route = "players/login/" + username + "/" + password; String route = "players/login/" + username + "/" + password;
String[] response = sendGetRequest(route); String[] response = sendGetRequest(route);
checkStatusCode(response); checkStatusCode(response);
...@@ -341,6 +343,8 @@ public final class QueryIntermediate { ...@@ -341,6 +343,8 @@ public final class QueryIntermediate {
public static Player createNewPlayer(String username, String password) throws IOException, NoSuchElementException { public static Player createNewPlayer(String username, String password) throws IOException, NoSuchElementException {
String route = "players/"; String route = "players/";
username = username.trim();
password = password.trim();
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("username", username); params.put("username", username);
params.put("password", password); params.put("password", password);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment