From 211127f9d3eda64255f19ac848a25efdce7afc23 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Tue, 22 Sep 2015 21:31:26 +0200 Subject: [PATCH] Refactored action to command --- doorlockd/logic.cpp | 20 ++++++++++---------- doorlockd/response.h | 2 +- webfrontend/index.php | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doorlockd/logic.cpp b/doorlockd/logic.cpp index 37cca17..2cf83be 100644 --- a/doorlockd/logic.cpp +++ b/doorlockd/logic.cpp @@ -58,10 +58,10 @@ Response Logic::parseRequest(const Json::Value &root) _logger(LogLevel::info, "Incoming request..."); Response response; - string action, user, password, ip, token; + string command, user, password, ip, token; try { - action = getJsonOrFail(root, "action"); + command = getJsonOrFail(root, "command"); ip = getJsonOrFail(root, "ip"); user = getJsonOrFail(root, "user"); password = getJsonOrFail(root, "password"); @@ -75,10 +75,10 @@ Response Logic::parseRequest(const Json::Value &root) goto out; } - _logger(" Action: " + action, LogLevel::notice); - _logger(" User : " + user, LogLevel::notice); - _logger(" IP : " + ip, LogLevel::notice); - _logger(" Token : " + token, LogLevel::notice); + _logger(" Command: " + command, LogLevel::notice); + _logger(" User : " + user, LogLevel::notice); + _logger(" IP : " + ip, LogLevel::notice); + _logger(" Token : " + token, LogLevel::notice); if (_checkToken(token) == false) { @@ -95,14 +95,14 @@ Response Logic::parseRequest(const Json::Value &root) goto out; } - if (action == "lock") + if (command == "lock") { response = _lock(); - } else if (action == "unlock") { + } else if (command == "unlock") { response = _unlock(); } else { - response.code = Response::Code::UnknownAction; - response.message = "Unknown Action: " + action; + response.code = Response::Code::UnknownCommand; + response.message = "Unknown Command: " + command; _logger(response.message, LogLevel::error); } diff --git a/doorlockd/response.h b/doorlockd/response.h index bf3c421..45d275e 100644 --- a/doorlockd/response.h +++ b/doorlockd/response.h @@ -15,7 +15,7 @@ struct Response InvalidToken, // Request contains invalid token InvalidCredentials, // Invalid LDAP credentials InvalidIP, // IP check failure - UnknownAction, // Unknown action + UnknownCommand, // Unknown action LDAPInit, // Ldap initialization failed } code; diff --git a/webfrontend/index.php b/webfrontend/index.php index 2f7c365..60e9ba1 100644 --- a/webfrontend/index.php +++ b/webfrontend/index.php @@ -1,10 +1,10 @@ "> - +
- +