From 21793ba0e63fe69b8dab574b8760370e4542d292 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Thu, 14 Dec 2023 06:50:38 +0000 Subject: [PATCH] =?UTF-8?q?=E7=BB=99passwd=E6=8C=87=E4=BB=A4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/engine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/engine.cpp b/backend/src/engine.cpp index 1745531..2519fcf 100644 --- a/backend/src/engine.cpp +++ b/backend/src/engine.cpp @@ -171,7 +171,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 &&