prepare for release
This commit is contained in:
@@ -59,22 +59,17 @@ int createUser(const std::string& username, const std::string& password){
|
||||
if (username.empty() || password.empty())
|
||||
return -1;
|
||||
|
||||
int64_t id;
|
||||
int64_t id = -1;
|
||||
auto db = dbpool.acquire();
|
||||
|
||||
for (auto &u : db->get_all<login::User>()) {
|
||||
if (u.username == username){
|
||||
std::cout << "WTF" << std::endl;
|
||||
id = u.id;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
auto user = db->get_optional<login::User>(
|
||||
where(c(&login::User::username) == username)
|
||||
);
|
||||
|
||||
if (user.has_value()) {
|
||||
id = user.value().id;
|
||||
} else {
|
||||
if (id < 0){
|
||||
User usr = newUser(username);
|
||||
createPasswordHash(usr, password);
|
||||
id = db->insert(usr);
|
||||
|
||||
Reference in New Issue
Block a user