diff --git a/app/src/main/java/github/luv/mockgeofix/command/PasswordCommand.java b/app/src/main/java/github/luv/mockgeofix/command/PasswordCommand.java index fe015fc..48c59c2 100644 --- a/app/src/main/java/github/luv/mockgeofix/command/PasswordCommand.java +++ b/app/src/main/java/github/luv/mockgeofix/command/PasswordCommand.java @@ -31,8 +31,10 @@ public void execute(SocketChannel client, String command) { String storedPassword = pref.getString("password",""); if (password.equals(storedPassword)) { mIsLoggedIn.put(client, Boolean.TRUE); + ResponseWriter.ok(client); } else { mIsLoggedIn.put(client, Boolean.FALSE); + ResponseWriter.writeLine(client, "KO: Incorrect password."); } } diff --git a/app/src/main/java/github/luv/mockgeofix/util/ResponseWriter.java b/app/src/main/java/github/luv/mockgeofix/util/ResponseWriter.java index 35c6053..3b55507 100644 --- a/app/src/main/java/github/luv/mockgeofix/util/ResponseWriter.java +++ b/app/src/main/java/github/luv/mockgeofix/util/ResponseWriter.java @@ -36,6 +36,10 @@ public static boolean writeLine(SocketChannel client, String response) { return write(client, response+"\r\n"); } + public static boolean ok(SocketChannel client) { + return write(client, "OK\r\n"); + } + public static boolean unknownCommand(SocketChannel client) { return write(client, "KO: unknown command, try 'help'\r\n"); }