🐎 improved getlogs endpoint when max log size is 0

This commit is contained in:
EntireTwix 2021-05-28 02:25:48 -07:00
parent a45dca028c
commit 239573e246

View file

@ -171,9 +171,9 @@ public:
Json::Value GetLogs(const std::string &name, const std::string &attempt) Json::Value GetLogs(const std::string &name, const std::string &attempt)
{ {
Json::Value res;
if constexpr (max_log_size) if constexpr (max_log_size)
{ {
Json::Value res;
if (!users.if_contains(name, [&res, &attempt](const User &u) { if (!users.if_contains(name, [&res, &attempt](const User &u) {
if (u.password != XXH3_64bits(attempt.data(), attempt.size())) if (u.password != XXH3_64bits(attempt.data(), attempt.size()))
{ {
@ -187,8 +187,12 @@ public:
{ {
return -1; return -1;
} }
}
return res; return res;
}
else
{
return "logs are disabled";
}
} }
void Save() void Save()