diff options
-rw-r--r-- | redfish-core/lib/account_service.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index bc8ce771d6..0658f3ff3b 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -1429,13 +1429,12 @@ class AccountsCollection : public Node crow::connections::systemBus->async_method_call( [asyncResp, username, password{std::move(password)}]( - const boost::system::error_code ec) { + const boost::system::error_code ec, + sdbusplus::message::message& m) { if (ec) { - messages::resourceAlreadyExists( - asyncResp->res, - "#ManagerAccount.v1_0_3.ManagerAccount", - "UserName", username); + userErrorMessageHandler(m.get_error(), asyncResp, + username, ""); return; } @@ -1446,16 +1445,17 @@ class AccountsCollection : public Node // but the password set failed.Something is wrong, // so delete the user that we've already created crow::connections::systemBus->async_method_call( - [asyncResp]( - const boost::system::error_code ec) { + [asyncResp, + password](const boost::system::error_code ec) { if (ec) { messages::internalError(asyncResp->res); return; } - messages::invalidObject(asyncResp->res, - "Password"); + // If password is invalid + messages::propertyValueFormatError( + asyncResp->res, password, "Password"); }, "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user/" + username, |