mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
🐛 AddUser() needs valid name check most of all
This commit is contained in:
parent
6c99d32a64
commit
521f8614dd
1 changed files with 4 additions and 0 deletions
|
|
@ -206,6 +206,10 @@ bool Bank::AdminVerifyAccount(const std::string &name) noexcept
|
||||||
}
|
}
|
||||||
BankResponse Bank::AddUser(const std::string &name, uint32_t init_bal, const std::string &init_pass) noexcept
|
BankResponse Bank::AddUser(const std::string &name, uint32_t init_bal, const std::string &init_pass) noexcept
|
||||||
{
|
{
|
||||||
|
if (!ValidUsername(name))
|
||||||
|
{
|
||||||
|
return {k400BadRequest, "\"Invalid Username\""};
|
||||||
|
}
|
||||||
std::shared_lock<std::shared_mutex> lock{save_lock};
|
std::shared_lock<std::shared_mutex> lock{save_lock};
|
||||||
if (users.try_emplace_l(
|
if (users.try_emplace_l(
|
||||||
name, [](User &) {}, init_bal, init_pass))
|
name, [](User &) {}, init_bal, init_pass))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue