🐛 fixed last commit

This commit is contained in:
EntireTwix 2021-04-21 19:20:40 -07:00
parent b0af12d4ce
commit 3965cc0ce3

View file

@ -61,25 +61,27 @@ public:
bool DelUser(const std::string &name, const std::string &attempt) bool DelUser(const std::string &name, const std::string &attempt)
{ {
bool state;
{ {
std::shared_lock<std::shared_mutex> lock{size_l}; std::shared_lock<std::shared_mutex> lock{size_l};
bool state = users.erase_if(name, [&attempt](User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); }); state = users.erase_if(name, [&attempt](User &u) { return (XXH3_64bits(attempt.data(), attempt.size()) == u.password); });
} }
if (state) if (state)
{ {
logs.erase_if(name, [](User &u) {}) logs.erase(name);
} }
return state; return state;
} }
bool AdminDelUser(const std::string &name, const std::string &attempt) bool AdminDelUser(const std::string &name, const std::string &attempt)
{ {
bool state;
{ {
std::shared_lock<std::shared_mutex> lock{size_l}; std::shared_lock<std::shared_mutex> lock{size_l};
bool state = users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); }); state = users.erase_if(name, [this, &attempt](const User &) { return (admin_pass == attempt); });
} }
if (state) if (state)
{ {
logs.erase_if(name, [](User &u) {}); logs.erase(name);
} }
return state; return state;
} }