generated from Sithas/conan_template
мелкие правки
This commit is contained in:
@@ -8,9 +8,7 @@
|
||||
|
||||
#include "IExecutor.h"
|
||||
#include "../DAO/IUserDAO.h"
|
||||
#include "../exceptions/exception400_bad_request.h"
|
||||
#include "../exceptions/exception409_conflict.h"
|
||||
#include "../exceptions/exception422_unprocessable_entity.h"
|
||||
#include "../exceptions/session_exception.h"
|
||||
|
||||
namespace uad
|
||||
{
|
||||
@@ -45,7 +43,7 @@ public:
|
||||
}
|
||||
catch (const system::system_error& err)
|
||||
{
|
||||
throw exception400_bad_request("cannot deserialize json");
|
||||
throw session_exception(http::status::bad_request, "cannot deserialize json");
|
||||
}
|
||||
|
||||
const std::string login = req_json.as_object().at("login").as_string().c_str();
|
||||
@@ -53,14 +51,15 @@ public:
|
||||
|
||||
if (!ValidateLogin(login) || !ValidatePassword(password))
|
||||
{
|
||||
throw exception422_unprocessable_entity(
|
||||
throw session_exception(
|
||||
http::status::unprocessable_entity,
|
||||
"Validations failed. Login should have length from 3 to 50. Password from 5 characters length."s
|
||||
);
|
||||
}
|
||||
|
||||
if (user_dao_->GetByLogin(login).has_value())
|
||||
{
|
||||
throw exception409_conflict("user with login "s + login + " exists"s);
|
||||
throw session_exception(http::status::conflict, "user with login "s + login + " exists"s);
|
||||
}
|
||||
|
||||
user user;
|
||||
|
||||
Reference in New Issue
Block a user