|
@@ -1,8 +1,6 @@
|
|
|
#include "../include/UserManager.h"
|
|
|
#include "../../libs/libbcrypt/bcrypt.h"
|
|
|
|
|
|
-// TODO read userStorage file location from config
|
|
|
-
|
|
|
// initialize static filename to empty string
|
|
|
std::string UserManager::filename = "";
|
|
|
|
|
@@ -66,7 +64,6 @@ bool UserManager::addUser(const std::string &name, const std::string &pw) {
|
|
|
}
|
|
|
|
|
|
bool UserManager::deleteUser(const std::string &name, const std::string &pw) {
|
|
|
- // TODO check pw before delete
|
|
|
std::map<std::string, std::string> user_map;
|
|
|
readFromFile(user_map);
|
|
|
auto it = user_map.find(name);
|
|
@@ -74,6 +71,7 @@ bool UserManager::deleteUser(const std::string &name, const std::string &pw) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ // checking password before deleting
|
|
|
std::string hash = it->second;
|
|
|
if (bcrypt_checkpw(pw.c_str(), hash.c_str()) != 0) {
|
|
|
return false;
|