mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
made Contains return -1 instead of 0 in false case
This commit is contained in:
parent
56bde9b341
commit
9b9d5cf430
4 changed files with 12 additions and 5 deletions
2
help.md
2
help.md
|
|
@ -33,7 +33,7 @@
|
|||
| Help | BankF/help | GET | false | the page you're looking at right now! |
|
||||
| Ping | BankF/ping | GET | false | for pinging the server to see if its online |
|
||||
| Close | BankF/admin/close | POST | true | saves and then closes the program if the supplied password matches the admin password |
|
||||
| Contains | BankF/contains/{name} | GET | false | returns `true` or `false` depending on if the supplied user `{name}` exists |
|
||||
| Contains | BankF/contains/{name} | GET | false | returns `1` if the supplied user `{name}` exists |
|
||||
| AdminVerifyPass | BankF/admin/verify | GET | true | returns `1` if the password supplied in the header matches the admin password |
|
||||
|
||||
# User Management
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
int_fast8_t SendFunds(const std::string &a_name, const std::string &b_name, uint32_t amount, const std::string &attempt);
|
||||
|
||||
bool Contains(const std::string &name) const;
|
||||
int_fast8_t Contains(const std::string &name) const;
|
||||
int_fast8_t AdminVerifyPass(const std::string &attempt);
|
||||
|
||||
int_fast8_t SetBal(const std::string &name, const std::string &attempt, uint32_t amount);
|
||||
|
|
|
|||
11
src/bank.cpp
11
src/bank.cpp
|
|
@ -163,9 +163,16 @@ int_fast8_t Bank::SendFunds(const std::string &a_name, const std::string &b_name
|
|||
}
|
||||
}
|
||||
|
||||
bool Bank::Contains(const std::string &name) const
|
||||
int_fast8_t Bank::Contains(const std::string &name) const
|
||||
{
|
||||
return users.contains(name);
|
||||
if (users.contains(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ErrorResponse::UserNotFound;
|
||||
}
|
||||
}
|
||||
int_fast8_t Bank::AdminVerifyPass(const std::string &attempt)
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue