From ef0e4859d1a258f77886f6941c6499dad276767e Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Sun, 4 Apr 2021 21:41:47 -0700 Subject: [PATCH] :construction: adding bindings for API --- include/bank.hpp | 10 +++++----- main.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/bank.hpp b/include/bank.hpp index 9ebba55..7fe18db 100644 --- a/include/bank.hpp +++ b/include/bank.hpp @@ -98,17 +98,17 @@ public: }); return res; } - int_fast8_t VerifyPassword(const std::string &name, const std::string &attempt) const + int_fast16_t VerifyPassword(const std::string &name, const std::string &attempt) const { - int_fast8_t res = -1; + int_fast16_t res = -1; users.if_contains(name, [&res, &attempt](const User &u) { res = u.password == attempt; }); return res; } - int_fast8_t ChangePassword(const std::string &name, const std::string &attempt, std::string &&new_pass) + int_fast16_t ChangePassword(const std::string &name, const std::string &attempt, std::string &&new_pass) { - int_fast8_t res = -1; + int_fast16_t res = -1; users.modify_if(name, [&res, &attempt, &new_pass](User &u) { res = (u.password == attempt); if (res) @@ -164,4 +164,4 @@ public: } } } -} Bank; +} bank; diff --git a/main.cpp b/main.cpp index 5ad8cb1..a9d2260 100644 --- a/main.cpp +++ b/main.cpp @@ -21,10 +21,10 @@ int main(int argc, char **argv) } //Loading users from users.json - Bank.Load(); + bank.Load(); //Admin Password - Bank.admin_pass = argv[1]; + bank.admin_pass = argv[1]; //Auto Saving const unsigned long saving_freq = std::stoul(argv[2]); @@ -34,12 +34,12 @@ int main(int argc, char **argv) while (1) { std::this_thread::sleep_for(std::chrono::minutes(saving_freq)); - Bank.Save(); + bank.Save(); } }).detach(); } - auto API = std::make_shared(); + auto API = std::make_shared(); app().addListener("0.0.0.0", 80).registerController(API).run(); return 0;