Fixed issue with special chars in login credentials

This commit is contained in:
Artem Pinchuk 2019-04-18 16:16:05 +10:00
parent 7e9c0000a5
commit 20a5f3fdf6
1 changed files with 4 additions and 1 deletions

View File

@ -55,7 +55,10 @@ public final class ApiConnectionImpl extends ApiConnection {
if (username.trim().isEmpty()) { if (username.trim().isEmpty()) {
throw new ApiConnectionException("API username cannot be empty"); throw new ApiConnectionException("API username cannot be empty");
} }
List<Map<String, String>> list = execute("/login name=" + username + " password=" + password); Command cmd = new Command("/login");
cmd.addParameter("name", username);
cmd.addParameter("password", password);
List<Map<String, String>> list = execute(cmd, timeout);
if (!list.isEmpty()) { if (!list.isEmpty()) {
Map<String, String> res = list.get(0); Map<String, String> res = list.get(0);
if (res.containsKey("ret")) { if (res.containsKey("ret")) {