mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 08:32:13 +11:00
✨ Contains
This commit is contained in:
parent
b80ff10c5b
commit
7c4da5771f
1 changed files with 8 additions and 4 deletions
|
|
@ -79,6 +79,10 @@ public:
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
bool Contains(const std::string &name) const
|
||||||
|
{
|
||||||
|
return users.if_contains(name, [](const User &) {});
|
||||||
|
}
|
||||||
|
|
||||||
int_fast64_t GetBal(const std::string &name) const
|
int_fast64_t GetBal(const std::string &name) const
|
||||||
{
|
{
|
||||||
|
|
@ -88,17 +92,17 @@ public:
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
int_fast32_t VerifyPassword(const std::string &name, const std::string &attempt) const
|
int_fast8_t VerifyPassword(const std::string &name, const std::string &attempt) const
|
||||||
{
|
{
|
||||||
int_fast32_t res = -1;
|
int_fast8_t res = -1;
|
||||||
users.if_contains(name, [&res, &attempt](const User &u) {
|
users.if_contains(name, [&res, &attempt](const User &u) {
|
||||||
res = u.password == attempt;
|
res = u.password == attempt;
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
int_fast32_t ChangePassword(const std::string &name, const std::string &attempt, std::string &&new_pass)
|
int_fast8_t ChangePassword(const std::string &name, const std::string &attempt, std::string &&new_pass)
|
||||||
{
|
{
|
||||||
int_fast32_t res = -1;
|
int_fast8_t res = -1;
|
||||||
users.modify_if(name, [&res, &attempt, &new_pass](User &u) {
|
users.modify_if(name, [&res, &attempt, &new_pass](User &u) {
|
||||||
res = (u.password == attempt);
|
res = (u.password == attempt);
|
||||||
if (res)
|
if (res)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue