Skip to content

Commit

Permalink
PasswordCommand: send OK/KO reply to the client
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Vacek committed Feb 25, 2015
1 parent 9e49237 commit 58027fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 58027fc

Please sign in to comment.