diff --git a/include/bank.hpp b/include/bank.hpp index 7d75dd7..6721db3 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -159,9 +159,15 @@ public: Json::Value GetLogs(const std::string &name, const std::string &attempt) { - Json::Value res = -1; + Json::Value res; users.if_contains(name, [&res, &attempt](const User &u) { - if (u.log.data.size() && u.password == XXH3_64bits(attempt.data(), attempt.size())) + if (u.password != XXH3_64bits(attempt.data(), attempt.size())) + { + res = 0; + return; + } + + if (u.log.data.size()) { uint32_t j; for (uint32_t i = u.log.data.size() - 1; i > 0; --i) @@ -177,10 +183,7 @@ public: res[j]["time"] = (Json::UInt64)u.log.data[i].time; } } - else - { - res = 0; - } + res = -1; }); return res; }