diff --git a/backend/src/engine.cpp b/backend/src/engine.cpp index 1e00162..4e7e43c 100644 --- a/backend/src/engine.cpp +++ b/backend/src/engine.cpp @@ -169,7 +169,10 @@ std::vector BookStoreEngineClass::ExecutePasswd( if (!CommandPasswdLexer(cmd, user_id, current_password, new_password)) return std::vector({"Invalid"}); // debugPrint("sucessfully lexed passwd"); - if (user_data_base.GetPrevilege(user_id) < 1) + if (user_data_base.GetPrevilege(user_id) == -1) + return std::vector({"Invalid"}); + if (login_stack.empty() || + user_data_base.GetPrevilege(login_stack.top().first) < 1) return std::vector({"Invalid"}); // debugPrint("begin checing authority"); if (login_stack.size() > 0 &&