修复了可以重复注册用户的bug

This commit is contained in:
2023-12-14 08:08:10 +00:00
parent 91e1161a58
commit ae8240839c

View File

@ -161,7 +161,7 @@ std::vector<std::string> BookStoreEngineClass::ExecuteRegister(
std::string user_id, password, user_name;
if (!CommandRegisterLexer(cmd, user_id, password, user_name))
return std::vector<std::string>({"Invalid"});
if (user_data_base.GetPrevilege(cmd) != -1)
if (user_data_base.GetPrevilege(user_id) != -1)
return std::vector<std::string>({"Invalid"});
user_data_base.AddUser(user_id, password, user_name, 1);
return std::vector<std::string>();