generated from Sithas/conan_template
Рабочая сборка с третьей ручкой
This commit is contained in:
@@ -37,7 +37,7 @@ public:
|
|||||||
using namespace boost::beast;
|
using namespace boost::beast;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
auto body = req.body();
|
const auto body = req.body();
|
||||||
value req_json;
|
value req_json;
|
||||||
value response_body;
|
value response_body;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<user> maybe_user = user_dao_->GetByLogin(login);
|
const std::optional<user> maybe_user = user_dao_->GetByLogin(login);
|
||||||
|
|
||||||
if (!maybe_user.has_value() || maybe_user.value().hashed_password != HashPassword(password))
|
if (!maybe_user.has_value() || maybe_user.value().hashed_password != HashPassword(password))
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
auto token = GenerateUUID();
|
const std::string token = GenerateUUID();
|
||||||
auth_dao_->Login(maybe_user.value().uuid, token);
|
auth_dao_->Login(maybe_user.value().uuid, token);
|
||||||
|
|
||||||
http::response<ResponseType> res{http::status::ok, req.version()};
|
http::response<ResponseType> res{http::status::ok, req.version()};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
using namespace boost::beast;
|
using namespace boost::beast;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
auto body = req.body();
|
const auto body = req.body();
|
||||||
value req_json;
|
value req_json;
|
||||||
|
|
||||||
value response_body;
|
value response_body;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
using namespace boost::beast;
|
using namespace boost::beast;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
auto body = req.body();
|
const auto& body = req.body();
|
||||||
value req_json;
|
value req_json;
|
||||||
value response_body;
|
value response_body;
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string login = req_json.as_object().at("login").as_string().c_str();
|
const std::string login = req_json.as_object().at("login").as_string().c_str();
|
||||||
std::string password = req_json.as_object().at("password").as_string().c_str();
|
const std::string password = req_json.as_object().at("password").as_string().c_str();
|
||||||
|
|
||||||
if (!ValidateLogin(login) || !ValidatePassword(password))
|
if (!ValidateLogin(login) || !ValidatePassword(password))
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
user.login = login;
|
user.login = login;
|
||||||
user.hashed_password = HashPassword(password);
|
user.hashed_password = HashPassword(password);
|
||||||
|
|
||||||
const auto uuid_stringified = user_dao_->Create(user);
|
const std::string uuid_stringified = user_dao_->Create(user);
|
||||||
|
|
||||||
http::response<ResponseType> res{
|
http::response<ResponseType> res{
|
||||||
http::status::created, req.version()
|
http::status::created, req.version()
|
||||||
|
|||||||
Reference in New Issue
Block a user