generated from Sithas/conan_template
мелкие правки
This commit is contained in:
@@ -21,14 +21,14 @@ class AuthLogoutExecutor : public IExecutor<Body, Allocator, ResponseType>
|
||||
|
||||
public:
|
||||
AuthLogoutExecutor(mysqlx::Session& session,
|
||||
const std::shared_ptr<IAuthDAO>& auth_dao)
|
||||
: session_(session), auth_dao_(auth_dao)
|
||||
const std::shared_ptr<IAuthDAO>& auth_dao) :
|
||||
session_(session), auth_dao_(auth_dao)
|
||||
{
|
||||
}
|
||||
|
||||
boost::beast::http::response<ResponseType> operator ()(
|
||||
boost::beast::http::request<Body, boost::beast::http::basic_fields<Allocator>>&& req
|
||||
) override
|
||||
) override
|
||||
{
|
||||
using namespace boost;
|
||||
using namespace boost::json;
|
||||
@@ -44,14 +44,14 @@ public:
|
||||
}
|
||||
catch (const system::system_error& err)
|
||||
{
|
||||
throw exception400_bad_request("cannot deserialize json"s);
|
||||
throw session_exception(http::status::internal_server_error, "cannot deserialize json"s);
|
||||
}
|
||||
|
||||
const std::string token = req_json.as_object().at("token").as_string().c_str();
|
||||
|
||||
if (!auth_dao_->Logout(token))
|
||||
{
|
||||
throw exception400_bad_request("token is not authorized"s);
|
||||
throw session_exception(http::status::bad_request, "token is not authorized"s);
|
||||
}
|
||||
|
||||
http::response<ResponseType> res{http::status::ok, req.version()};
|
||||
|
||||
Reference in New Issue
Block a user