mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🔥 removed return on delete temporarily
This commit is contained in:
parent
3e79d4e7a3
commit
36ee1e6635
1 changed files with 2 additions and 20 deletions
22
src/bank.cpp
22
src/bank.cpp
|
|
@ -43,16 +43,7 @@ int_fast8_t Bank::DelUser(const std::string &name, const std::string &attempt) n
|
||||||
{
|
{
|
||||||
std::shared_lock<std::shared_mutex> lock{size_l};
|
std::shared_lock<std::shared_mutex> lock{size_l};
|
||||||
bool state = false;
|
bool state = false;
|
||||||
if (users.erase_if(name, [this, &name, &state, &attempt](User &u) {
|
if (users.erase_if(name, [&state, &attempt](User &u) { return state = (XXH3_64bits(attempt.data(), attempt.size()) == u.password); }))
|
||||||
if constexpr (return_on_del)
|
|
||||||
{
|
|
||||||
if (SendFunds(name, return_account, u.balance, attempt) == 1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state = (XXH3_64bits(attempt.data(), attempt.size()) == u.password);
|
|
||||||
}))
|
|
||||||
{
|
{
|
||||||
return (state) ? true : ErrorResponse::WrongPassword;
|
return (state) ? true : ErrorResponse::WrongPassword;
|
||||||
}
|
}
|
||||||
|
|
@ -65,16 +56,7 @@ int_fast8_t Bank::AdminDelUser(const std::string &name, const std::string &attem
|
||||||
{
|
{
|
||||||
std::shared_lock<std::shared_mutex> lock{size_l};
|
std::shared_lock<std::shared_mutex> lock{size_l};
|
||||||
bool state = false;
|
bool state = false;
|
||||||
if (users.erase_if(name, [this, &name, &state, &attempt](const User &u) {
|
if (users.erase_if(name, [this, &state, &attempt](const User &) { return state = (admin_pass == attempt); }))
|
||||||
if constexpr (return_on_del)
|
|
||||||
{
|
|
||||||
if (SendFunds(name, return_account, u.balance, attempt) == 1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return state = (XXH3_64bits(attempt.data(), attempt.size()) == u.password);
|
|
||||||
}))
|
|
||||||
{
|
{
|
||||||
return (state) ? true : ErrorResponse::WrongPassword;
|
return (state) ? true : ErrorResponse::WrongPassword;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue