added better database lookup api
This commit is contained in:
@@ -94,9 +94,9 @@ bool loginUser(const std::string& username, const std::string& password)
|
||||
if (!db.open())
|
||||
return false;
|
||||
|
||||
auto opt_str = db.get<std::string>(sql, {username});
|
||||
if (opt_str.has_value()) {
|
||||
return verifyHashWithPassword(opt_str.value(), password);
|
||||
auto opt_pair = db.get<int, std::string>(sql, {username});
|
||||
if (opt_pair.has_value()) {
|
||||
return verifyHashWithPassword(opt_pair.value().second, password);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user